Page 1 of 1
[SOLVED] sabnzbd creating Downloads folder before external Drive can mount
Posted: August 18th, 2010, 12:48 pm
by Xeijin
Version: 0.5.3
OS: Ubuntu (Karmic - Minimal)
Install-type: Linux Repo
Skin (if applicable): Plush
Firewall Software: none
Are you using IPV6? no
Is the issue reproducible? yes
I'm trying to get sab to download to my External NTFS Hard Drive. The drive is set to mount to /media/Media Server, and I have configured the folders Tab in Sab to send downloads to /media/Media Server/Downloads
The problem is that when I reboot, sab creates this folder before my NTFS drive can actually mount, this means that my NTFS drive then gets mounted to "/media/Media Server_" instead of "/media/Media Server".
So my question is:
Can I prevent Sab trying to consistently create this directory?
if not...
Can I force Ubuntu to mount my NTFS drive *before* sab tries to create the directory?
I tried mounting my NTFS drive in /etc/fstab, but to be honest I don't know what I'm doing and either way it didn't seem to work...
Thanks in advance for your help.
Re: sabnzbd creating Downloads folder before external Drive can mount
Posted: August 18th, 2010, 1:18 pm
by shypike
Don't know how you start SABnzbd.
Through a script? If so, you'll need to add a sleep statement in the script.
60 seconds should do.
Re: sabnzbd creating Downloads folder before external Drive can mount
Posted: August 18th, 2010, 1:34 pm
by Xeijin
I believe SAB is starting through an init.d script, where do I go about adding the sleep statement to the script?
Edit: Also, would this cause a delay in boot? (I am using the PC as a media centre with XBMC installed, so ideally I'd like to keep boot times as low as possible).
Here is the script:
Code: Select all
#!/bin/sh
#
# Copyright (C) 2008-2010 by JCF Ploemen <[email protected]>
# released under GPL, version 2 or later
################################################
# #
# TO CONFIGURE EDIT /etc/default/sabnzbdplus #
# #
################################################
### BEGIN INIT INFO
# Provides: sabnzbdplus
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Should-Start: NetworkManager
# Should-Stop: NetworkManager
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: SABnzbd+ binary newsgrabber
### END INIT INFO
DAEMON=/usr/bin/sabnzbdplus
SETTINGS=/etc/default/sabnzbdplus
([ -x $DAEMON ] && [ -r $SETTINGS ]) || exit 0
DESC="SABnzbd+ binary newsgrabber"
DEFOPTS="--daemon"
PYTHONEXEC="^$(sed -n '1s/^#\!\([a-z0-9\.\/]\+\)\(.*\)/\1(\2)?/p' $DAEMON)"
PIDFILE=/var/run/sabnzbdplus.pid
# these are only accepted from the settings file
unset USER CONFIG HOST PORT EXTRAOPTS
. /lib/lsb/init-functions
check_retval() {
if [ $? -eq 0 ]; then
log_end_msg 0
return 0
else
log_end_msg 1
exit 1
fi
}
is_running() {
# returns 0 when running, 1 otherwise
PID="$(pgrep -f -x -u $USER "$PYTHONEXEC $DAEMON $DEFOPTS.*")"
RET=$?
[ $RET -gt 1 ] && exit 1 || return $RET
}
load_settings() {
. $SETTINGS
[ -z "$USER" ] && {
log_warning_msg "$DESC: not configured, aborting. See $SETTINGS";
return 1; }
OPTIONS="$DEFOPTS"
[ -n "$CONFIG" ] && OPTIONS="$OPTIONS --config-file $CONFIG"
[ -n "$HOST" ] && SERVER="$HOST" || SERVER=
[ -n "$PORT" ] && SERVER="$SERVER:$PORT"
[ -n "$SERVER" ] && OPTIONS="$OPTIONS --server $SERVER"
[ -n "$EXTRAOPTS" ] && OPTIONS="$OPTIONS $EXTRAOPTS"
return 0
}
case "$1" in
start)
load_settings || exit 0
if ! is_running; then
log_daemon_msg "Starting $DESC"
start-stop-daemon --quiet --chuid $USER --start --exec $DAEMON -- $OPTIONS
check_retval
# create a pidfile; we don't use it but some monitoring app likes to have one
[ -w $(dirname $PIDFILE) ] && \
pgrep -f -x -n -u $USER "$PYTHONEXEC $DAEMON $OPTIONS" > $PIDFILE
else
log_success_msg "$DESC: already running (pid $PID)"
fi
;;
stop)
load_settings || exit 0
if is_running; then
TMPFILE=$(mktemp /tmp/sabnzbdplus.XXXXXXXXXX || exit 1)
trap '[ -f $TMPFILE ] && rm -f $TMPFILE' EXIT
echo "$PID" > $TMPFILE
log_daemon_msg "Stopping $DESC"
start-stop-daemon --stop --user $USER --pidfile $TMPFILE --retry 30
check_retval
else
log_success_msg "$DESC: not running"
fi
[ -f $PIDFILE ] && rm -f $PIDFILE
;;
force-reload|restart)
$0 stop || exit $?
$0 start || exit $?
;;
status)
load_settings || exit 4
if is_running; then
log_success_msg "$DESC: running (pid $PID)"
else
log_success_msg "$DESC: not running"
[ -f $PIDFILE ] && exit 1 || exit 3
fi
;;
*)
log_failure_msg "Usage: $0 {start|stop|restart|force-reload|status}"
exit 3
;;
esac
exit 0
Edit: Nevermind, got it working by mounting through fstab. For anyone who happens to be in a similar situation this is what I did:
Mounting an External NTFS drive through fstab (Ubuntu Karmic)
1. Find the UUID of the drive you want mounted by doing:
2. Add the drive to fstab using your favourite editor. E.g.
3. Add the following line to the end of fstab inserting your UUID where specified, and the mount point for the drive
Code: Select all
UUID=<<UUID OF YOUR DRIVE>> <<mount point - e.g. /media/Storage>> ntfs-3g auto,users,uid=1000,gid=100,dmask=027,fmask=137,utf8 0 0
4. Save and reboot.
Re: [SOLVED] sabnzbd creating Downloads folder before external Drive can mount
Posted: September 1st, 2010, 11:14 pm
by monmon_4
Waiting for a solution to this for a while. Amazing, thank you.
There should be an option in sabnzbd to delay boot time or edit fstab like this for you. Just a thought since a lot of people use sabnzbd with XBMC Live based on Ubuntu.
Re: [SOLVED] sabnzbd creating Downloads folder before external Drive can mount
Posted: November 29th, 2010, 1:28 pm
by pabloikba
Thanks for the soluition.