Changes between Version 5 and Version 6 of UserGuide/Service/systemd


Ignore:
Timestamp:
10/17/2015 01:37:23 PM (9 years ago)
Author:
Cas
Comment:

tidy up and reword

Legend:

Unmodified
Added
Removed
Modified
  • UserGuide/Service/systemd

    v5 v6  
    11= systemd Scripts = 
    22 
    3 Firstly ensure Deluge daemon `deluged` and Web UI `deluge-web` are [wiki:Installing/Linux installed]. 
     3'''Note:''' Improvements to propagate from [wiki:UserGuide/Service/Upstart/ Upstart] still: deluge-web starting upon deluged starting and filesystems are mounted e.g. `local-fs.target` and `remote-fs.target`. 
    44 
    5 '''Note:''' Improvements to propagate from [wiki:UserGuide/Service/Upstart/ Upstart] still: deluge-web starting upon deluged starting and filesystems are mounted e.g. `local-fs.target` and `remote-fs.target`. 
     5 
     6== Verify Deluge Installion == 
     7 
     8Ensure Deluge daemon `deluged` and Web UI `deluge-web` are [wiki:Installing/Linux installed].  
     9 
     10Use `which deluged` or `which deluge-web` to check installation path.  
     11 
     12If they are not installed in the usual `/usr/bin` modify the service file ExecStart lines to point to the correct location (e.g. `/usr/local/bin/deluged`). 
    613 
    714== User Management == 
     
    2229 
    2330 
    24 == Migration from init.d or upstart script == 
    25 Get rid of any old init files named deluge in `/etc/init.d/` like this: 
     31== Migration from init.d or Upstart scripts == 
     32Remove any old init.d files named deluge in `/etc/init.d/` like this: 
    2633{{{ 
    2734sudo /etc/init.d/deluge-daemon stop 
     
    3946 
    4047== Deluge Daemon (deluged) Service == 
    41 Create the file `/etc/systemd/system/deluged.service`: 
     48Create the file `/etc/systemd/system/deluged.service` containing the following: 
    4249{{{ 
    4350[Unit] 
     
    5562Restart=on-failure 
    5663 
     64# Configures the time to wait before service is stopped forcefully. 
    5765TimeoutStopSec=300 
    5866 
     
    6169}}} 
    6270 
    63 Now start the service and verify it is running: 
     71Now start the service, verify it is running and enable it to start up on boot: 
    6472{{{ 
    6573systemctl start deluged 
    6674systemctl status deluged 
     75systemctl enable deluged 
    6776}}} 
    6877 
    6978== Deluge Web UI (deluge-web) Service == 
    7079 
    71 Create the file `/etc/systemd/system/deluge-web.service`: 
     80Create the file `/etc/systemd/system/deluge-web.service` containing the following: 
    7281{{{ 
    7382[Unit] 
     
    9099}}} 
    91100 
    92 Now start the service and verify it is running: 
     101Now start the service, verify it is running and enable it to start up on boot: 
    93102{{{ 
    94103systemctl start deluge-web 
    95104systemctl status deluge-web 
    96 }}} 
    97  
    98 == Enable the service on boot == 
    99  
    100 Enable the services to start up on boot: 
    101 {{{ 
    102 systemctl enable deluged 
    103105systemctl enable deluge-web 
    104106}}} 
    105107 
    106108== Logging == 
    107 Create a structure for Deluge to log to and give the user that Deluge is running as (in this case `deluge`) full access to that directory: 
     109Create a log directory for Deluge and give the service user (e.g. `deluge`), full access: 
    108110{{{ 
    109111sudo mkdir -p /var/log/deluge 
     
    111113sudo chmod -R 750 /var/log/deluge 
    112114}}} 
    113  * Note: The above commands affect the log directory and all files within it, combined with the umask specified in the upstart jobs these affect the permissions new logs are created with. 
    114   * 750 grants full access to the deluge user, only recurse tree and read access to members of the deluge group and prevents access from all other accounts. [http://en.wikipedia.org/wiki/Chmod#Octal_numbers Chmod] 
    115 Edit the service files like so: 
     115 * The deluge log directory is now configured so that user `deluge` has full access, group `deluge` read only and everyone else denied access. The `umask` specified in the services sets the permission of new log files. 
     116 
     117Enable logging in the service files by editing the `ExecStart` line, appending `-l` and `-L` options: 
    116118{{{ 
    117119ExecStart=/usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning 
     
    120122ExecStart=/usr/bin/deluge-web -l /var/log/deluge/web.log -L warning 
    121123}}}  
    122  * Refer to the [wiki:Faq#EnableDelugeLogging FAQ] for possible log-levels. 
     124 * See [wiki:Troubleshooting#EnableDelugeLogging Deluge Logging] for all available log-levels. 
    123125 
    124 Restart the daemon: 
     126Restart the services: 
    125127{{{ 
    126 sudo restart deluged 
     128systemctl restart deluged 
     129systemctl restart deluge-web 
    127130}}} 
    128131 
    129 Create `/etc/logrotate.d/deluge` with the following code to rotate the logs: 
     132=== Log Rotation === 
     133To enable log rotation create `/etc/logrotate.d/deluge` with the following code: 
    130134{{{ 
    131135/var/log/deluge/*.log { 
     
    138142        sharedscripts 
    139143        postrotate 
    140                 initctl restart deluged >/dev/null 2>&1 || true 
    141                 initctl restart deluge-web >/dev/null 2>&1 || true 
     144                systemctl restart deluged >/dev/null 2>&1 || true 
     145                systemctl restart deluge-web >/dev/null 2>&1 || true 
    142146        endscript 
    143147}