A couple of necessary steps:
1. The SABnzbd source has been moved to: /usr/share/SABnzbd
2. The Episode Butler source has been moved to: /home/username/.episodebutler
3. Set the variables: be sure to properly edit the variables in these scripts to match your setup (username, home dir, ip address:port, login, password, etc)
Once these things are in place, save the script to /etc/init.d/sabnzbd.sh
Make the script executable:
Code: Select all
sudo chmod +x /etc/init.d/sabnzbd.sh
Code: Select all
sudo update-rc.d sabnzbd.sh start 30 2 3 4 5 . stop 14 0 1 6 .
Code: Select all
/etc/init.d/sabnzbd.sh start
Code: Select all
/etc/init.d/sabnzbd.sh stop
This is for Pre SABnzbd 0.4.9 (No API Key Required)
Code: Select all
#! /bin/sh
### BEGIN INIT INFO
# Provides: sabnzbd, episode butler
# Short-Description: start/stop sabnzbd and episode butler web interface
### END INIT INFO
USER="username"
HOME="/home/username"
SAB_IP="192.168.1.2:8081"
SAB_USER="login"
SAB_PASS="password"
BUTLER_IP="192.168.1.2:8082"
BUTLER_USER="login"
BUTLER_PASS="password"
case "$1" in
start)
echo "Starting SABnzbd."
/usr/bin/sudo -u $USER -H /usr/share/SABnzbd/SABnzbd.py -d -f $HOME/.sabnzbd/sabnzbd.ini
sleep 2
echo "Starting Episode Butler."
/usr/bin/sudo -u $USER -H $HOME/.episodebutler/./episodebutler &
;;
stop)
echo "Shutting down SABnzbd."
/usr/bin/wget -q --delete-after "http://$SAB_IP/sabnzbd/api?mode=shutdown&ma_username=$SAB_USER&ma_password=$SAB_PASS"
echo "Shutting down Episode Butler."
/usr/bin/wget -q --delete-after --post-data=username=$BUTLER_USER\&password=$BUTLER_PASS "http://$BUTLER_IP/quit"
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0
Code: Select all
#! /bin/sh
### BEGIN INIT INFO
# Provides: sabnzbd, episode butler
# Short-Description: start/stop sabnzbd and episode butler web interface
### END INIT INFO
USER="username"
HOME="/home/username"
SAB_IP="192.168.1.2:8081"
SAB_USER="login"
SAB_PASS="password"
SAB_APIKEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
BUTLER_IP="192.168.1.2:8082"
BUTLER_USER="login"
BUTLER_PASS="password"
case "$1" in
start)
echo "Starting SABnzbd."
/usr/bin/sudo -u $USER -H /usr/share/SABnzbd/SABnzbd.py -d -f $HOME/.sabnzbd/sabnzbd.ini
sleep 2
echo "Starting Episode Butler."
/usr/bin/sudo -u $USER -H $HOME/.episodebutler/./episodebutler &
;;
stop)
echo "Shutting down SABnzbd."
/usr/bin/wget -q --delete-after "http://$SAB_IP/sabnzbd/api?mode=shutdown&ma_username=$SAB_USER&ma_password=$SAB_PASS&apikey=$SAB_APIKEY"
echo "Shutting down Episode Butler."
/usr/bin/wget -q --delete-after --post-data=username=$BUTLER_USER\&password=$BUTLER_PASS "http://$BUTLER_IP/quit"
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0
tret