☰
QuidsUp - Scripts - Deluge Init Script
Deluge Init Script
Init script to run Deluge Daemon from the Deluge Torrent Downloader in headless form at Bootup Time.
It can be used with Debian or Ubuntu based Linux Distros. Its ideal for turning a Raspberry Pi into a torrent server.
See my video How to Setup Deluge Daemon on Headless Server for more info.
Install Instructions:
sudo apt-get install deluged deluge-webui wget quidsup.net/sh/init-deluge.sh nano init-deluge.sh #Make necessary changes to the file sudo mv init-deluge /etc/init.d cd /etc/init.d mv init-deluge.sh deluge chmod 755 deluge update-rc.d deluge defaults service deluge start
Init Script:
#! /bin/sh ### BEGIN INIT INFO # Provides: deluged # Required-Start: $network $remote_fs $syslog # Required-Stop: $network $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start deluged at boot time # Description: Start DelugeD and Deluge-Web. ### END INIT INFO #Author QuidsUp #Last Modified 26 Jan 2013 #Required -- To be changed! USER=username #Set Username here. PORT=8112 #Set port number for web interface (default 8112) PIDFileDeluge=/var/run/deluged.pid PIDFileWeb=/var/run/deluge-web.pid case "$1" in start) echo "Starting Deluge" start-stop-daemon --start --chuid $USER --name deluged --pidfile $PIDFileDeluge \ --background --make-pidfile --exec /usr/bin/deluged -- --do-not-daemonize start-stop-daemon --start --chuid $USER --name deluge-web --pidfile $PIDFileWeb \ --background --make-pidfile --exec /usr/bin/deluge-web -- --port $PORT ;; stop) echo "Stopping Deluge" start-stop-daemon --stop --chuid $USER --name deluged --pidfile $PIDFileDeluge start-stop-daemon --stop --chuid $USER --name deluge-web --pidfile $PIDFileWeb ;; restart|force-reload) echo "Stopping Deluge for Restart" start-stop-daemon --stop --chuid $USER --name deluged --pidfile $PIDFileDeluge start-stop-daemon --stop --chuid $USER --name deluge-web --pidfile $PIDFileWeb sleep 5s echo "Restarting Deluge" start-stop-daemon --start --chuid $USER --name deluged --pidfile $PIDFileDeluge \ --background --make-pidfile --exec /usr/bin/deluged -- --do-not-daemonize start-stop-daemon --start --chuid $USER --name deluge-web --pidfile $PIDFileWeb \ --background --make-pidfile --exec /usr/bin/deluge-web -- --port $PORT ;; status) echo "Checking Status of Deluge" if (test -f $PIDFileDeluge); then PIDVal=$(head -1 $PIDFileDeluge) if [ -e /proc/$PIDVal ]; then echo -n "DelugeD Running on Process ID: " echo $PIDVal echo ps -H $PIDVal else echo "DelugeD Not Running but PID File Exists" exit 1 fi else echo "No PID File found for DelugeD" fi ;; *) echo "Usage: deluge {start|stop|restart|force-reload|status}" >&2 exit 1 ;; esac exit 0