I am messing with the problem all day, and it's making me crazy.
I am using this script (http://dl.dropbox.com/u/5830692/sickbeard.txt) which I modified and changed a little.
I also use this same script for SABnzbd and CouchPotato. All 3 are Python scripts.
I added these 3 rules to rc.conf to make the scripts start at boot.
I tested all 3 scripts at command-line and they all worked.
Then it was time to test them, and I rebooted my system.
Only 2 of them work... x( They all have the same permissions and same owner (root).
I also enabled console logging and there I see the system does not even try to start it.
I tried deleting the script and make it all over from scratch.
But my thoughts are: If it works from command-line why should it not work at boot.
I hope someone can help me with the mysterious problem.
I am using this script (http://dl.dropbox.com/u/5830692/sickbeard.txt) which I modified and changed a little.
I also use this same script for SABnzbd and CouchPotato. All 3 are Python scripts.
Code:
#!/bin/sh
#
# PROVIDE: sickbeard
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# sickbeard_enable (bool): Set to NO by default.
# Set it to YES to enable it.
# sickbeard_user: The user account Sick Beard daemon runs as what
# you want it to be. It uses '_sabnzbd' user by
# default. Do not sets it as empty or it will run
# as root.
# sickbeard_dir: Directory where Sick Beard lives.
# Default: /usr/local/sickbeard
# sickbeard_chdir: Change to this directory before running Sick Beard.
# Default is same as sickbeard_dir.
# sickbeard_pid: The name of the pidfile to create.
# Default is sickbeard.pid in sickbeard_dir.
. /etc/rc.subr
name="sickbeard"
rcvar=${name}_enable
load_rc_config ${name}
: ${sickbeard_enable:="NO"}
: ${sickbeard_user:="werner"}
: ${sickbeard_dir:="/usr/home/werner/Applications/sickbeard"}
: ${sickbeard_chdir:="${sickbeard_dir}"}
: ${sickbeard_pid:="${sickbeard_dir}/sickbeard.pid"}
WGET="/usr/local/bin/wget" # You need wget for this script to safely shutdown Sick Beard.
HOST="127.0.0.1" # Set Sick Beard address here.
PORT="8081" # Set Sick Beard port here.
SBUSR="" # Set Sick Beard username (if you use one) here.
SBPWD="" # Set Sick Beard password (if you use one) here.
status_cmd="${name}_status"
stop_cmd="${name}_stop"
command="/usr/sbin/daemon"
command_args="-f -p ${sickbeard_pid} python ${sickbeard_dir}/SickBeard.py -d"
# Ensure user is root when running this script.
if [ `id -u` != "0" ]; then
echo "Oops, you should be root before running this!"
exit 1
fi
verify_sickbeard_pid() {
# Make sure the pid corresponds to the Sick Beard process.
pid=`cat ${sickbeard_pid} 2>/dev/null`
ps -p ${pid} | grep -q "python ${sickbeard_dir}/SickBeard.py"
return $?
}
# Try to stop Sick Beard cleanly by calling shutdown over http.
sickbeard_stop() {
echo "Stopping $name"
verify_sickbeard_pid
kill ${pid}
if [ -n "${pid}" ]; then
wait_for_pids ${pid}
echo "Stopped"
fi
}
sickbeard_status() {
verify_sickbeard_pid && echo "$name is running as ${pid}" || echo "$name is not running"
}
run_rc_command "$1"
I added these 3 rules to rc.conf to make the scripts start at boot.
Code:
sabnzbd_enable="YES"
sickbeard_enable="YES"
couchpotato_enable="YES"
I tested all 3 scripts at command-line and they all worked.
Then it was time to test them, and I rebooted my system.
Only 2 of them work... x( They all have the same permissions and same owner (root).
I also enabled console logging and there I see the system does not even try to start it.
Code:
Apr 3 18:47:16 FreeBSD kernel: Starting syslogd.
Apr 3 18:47:16 FreeBSD kernel: Clearing /tmp (X related).
Apr 3 18:47:17 FreeBSD kernel: Removing stale Samba tdb files:
Apr 3 18:47:17 FreeBSD kernel: .
Apr 3 18:47:17 FreeBSD last message repeated 6 times
Apr 3 18:47:17 FreeBSD kernel: done
Apr 3 18:47:17 FreeBSD kernel: Starting nmbd.
Apr 3 18:47:17 FreeBSD kernel: Starting smbd.
Apr 3 18:47:18 FreeBSD kernel: Starting sabnzbd.
Apr 3 18:47:19 FreeBSD kernel: Starting couchpotato.
Apr 3 18:47:19 FreeBSD kernel: Updating motd:
Apr 3 18:47:19 FreeBSD kernel: .
Apr 3 18:47:20 FreeBSD kernel: Configuring syscons:
Apr 3 18:47:20 FreeBSD kernel: keymap
Apr 3 18:47:20 FreeBSD kernel: blanktime
Apr 3 18:47:20 FreeBSD kernel: .
Apr 3 18:47:20 FreeBSD kernel: Starting sshd.
I tried deleting the script and make it all over from scratch.
But my thoughts are: If it works from command-line why should it not work at boot.
I hope someone can help me with the mysterious problem.