Changes between Initial Version and Version 1 of UserGuide/Service/Upstart


Ignore:
Timestamp:
03/25/2012 02:13:39 PM (12 years ago)
Author:
kit
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UserGuide/Service/Upstart

    v1 v1  
     1= Ubuntu Upstart Job = 
     2 
     3Based on the previous Ubuntu scripts [http://dev.deluge-torrent.org/wiki/UserGuide/InitScript/Ubuntu/ here]. 
     4 
     5=== Notes === 
     6 * This seems to work for me. 
     7 * I can't remember if I manually created the deluge user first, you may need to. 
     8 * Please update this guide if you can improve it. 
     9 
     10== Upstart Jobs == 
     11Put this in /etc/init/deluge.conf and set uid and gid to the user and group you wish to run deluge as: 
     12{{{ 
     13start on (filesystem and networking) or runlevel [2345] 
     14stop on runlevel [016] 
     15 
     16env uid=deluge 
     17env gid=deluge 
     18 
     19exec start-stop-daemon -S -c $uid:$gid -x /usr/bin/deluged -- -d 
     20}}} 
     21 
     22This should be placed in /etc/init/deluge-web.conf, remember to set uid and gid to your preference: 
     23{{{ 
     24start on started deluge 
     25stop on stopping deluge 
     26 
     27env uid=deluge 
     28env gid=deluge 
     29 
     30exec start-stop-daemon -S -c $uid:$gid -x /usr/bin/deluge-web 
     31}}} 
     32 
     33==== Migration ==== 
     34If you followed the old guide to make an init script, remove it: 
     35{{{ 
     36#!sh 
     37sudo /etc/init.d/deluge-daemon stop 
     38sudo rm /etc/init.d/deluge-daemon 
     39sudo update-rc.d deluge-daemon remove 
     40}}} 
     41 
     42==== Start deluge ==== 
     43{{{ 
     44#!sh 
     45sudo start deluge 
     46}}} 
     47 
     48==== Web UI ==== 
     49 * To prevent the web-ui starting automatically after deluge just remove the 'start on' line from deluge-web.conf. The web-ui can then be started (and stopped) manually with: 
     50{{{ 
     51#!sh 
     52sudo start deluge-web # sudo stop deluge-web 
     53}}} 
     54 
     55 
     56== Logging == 
     57Create a structure for deluge to log to: 
     58{{{ 
     59#!sh 
     60sudo mkdir -p /var/log/deluge 
     61}}} 
     62Give the user that deluge is running as (in this case deluge) write-access to the logs: 
     63{{{ 
     64#!sh 
     65sudo chmod -R 755 /var/log/deluge 
     66sudo chown -R deluge /var/log/deluge 
     67}}} 
     68Edit the init confs like so: 
     69{{{ 
     70exec start-stop-daemon -S -c $uid:$gid -x /usr/bin/deluged -- -d -l /var/log/deluge/daemon.log -L warning 
     71}}} 
     72{{{ 
     73exec start-stop-daemon -S -c $uid:$gid -x /usr/bin/deluge-web -- -l /var/log/deluge/web.log -L warning 
     74}}}  
     75 * See [wiki:Faq#EnableDelugeLogging Logging] for possible log-levels. 
     76 
     77Restart the daemon: 
     78{{{ 
     79sudo restart deluge 
     80}}} 
     81 
     82Tell logrotate to rotate the logs by putting this in /etc/logrotate.d/deluge: 
     83{{{ 
     84/var/log/deluge/*.log { 
     85        rotate 4 
     86        weekly 
     87        missingok 
     88        notifempty 
     89        compress 
     90        delaycompress 
     91        sharedscripts 
     92        postrotate 
     93                initctl restart deluge >/dev/null 2>&1 || true 
     94                initctl restart deluge-web >/dev/null 2>&1 || true 
     95        endscript 
     96} 
     97}}}