Changes between Version 5 and Version 6 of UserGuide/Service/systemd
- Timestamp:
- 10/17/2015 01:37:23 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
UserGuide/Service/systemd
v5 v6 1 1 = systemd Scripts = 2 2 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`. 4 4 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 8 Ensure Deluge daemon `deluged` and Web UI `deluge-web` are [wiki:Installing/Linux installed]. 9 10 Use `which deluged` or `which deluge-web` to check installation path. 11 12 If 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`). 6 13 7 14 == User Management == … … 22 29 23 30 24 == Migration from init.d or upstart script==25 Get rid of any old initfiles named deluge in `/etc/init.d/` like this:31 == Migration from init.d or Upstart scripts == 32 Remove any old init.d files named deluge in `/etc/init.d/` like this: 26 33 {{{ 27 34 sudo /etc/init.d/deluge-daemon stop … … 39 46 40 47 == Deluge Daemon (deluged) Service == 41 Create the file `/etc/systemd/system/deluged.service` :48 Create the file `/etc/systemd/system/deluged.service` containing the following: 42 49 {{{ 43 50 [Unit] … … 55 62 Restart=on-failure 56 63 64 # Configures the time to wait before service is stopped forcefully. 57 65 TimeoutStopSec=300 58 66 … … 61 69 }}} 62 70 63 Now start the service and verify it is running:71 Now start the service, verify it is running and enable it to start up on boot: 64 72 {{{ 65 73 systemctl start deluged 66 74 systemctl status deluged 75 systemctl enable deluged 67 76 }}} 68 77 69 78 == Deluge Web UI (deluge-web) Service == 70 79 71 Create the file `/etc/systemd/system/deluge-web.service` :80 Create the file `/etc/systemd/system/deluge-web.service` containing the following: 72 81 {{{ 73 82 [Unit] … … 90 99 }}} 91 100 92 Now start the service and verify it is running:101 Now start the service, verify it is running and enable it to start up on boot: 93 102 {{{ 94 103 systemctl start deluge-web 95 104 systemctl 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 deluged103 105 systemctl enable deluge-web 104 106 }}} 105 107 106 108 == 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:109 Create a log directory for Deluge and give the service user (e.g. `deluge`), full access: 108 110 {{{ 109 111 sudo mkdir -p /var/log/deluge … … 111 113 sudo chmod -R 750 /var/log/deluge 112 114 }}} 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 E dit 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 117 Enable logging in the service files by editing the `ExecStart` line, appending `-l` and `-L` options: 116 118 {{{ 117 119 ExecStart=/usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning … … 120 122 ExecStart=/usr/bin/deluge-web -l /var/log/deluge/web.log -L warning 121 123 }}} 122 * Refer to the [wiki:Faq#EnableDelugeLogging FAQ] for possible log-levels.124 * See [wiki:Troubleshooting#EnableDelugeLogging Deluge Logging] for all available log-levels. 123 125 124 Restart the daemon:126 Restart the services: 125 127 {{{ 126 sudo restart deluged 128 systemctl restart deluged 129 systemctl restart deluge-web 127 130 }}} 128 131 129 Create `/etc/logrotate.d/deluge` with the following code to rotate the logs: 132 === Log Rotation === 133 To enable log rotation create `/etc/logrotate.d/deluge` with the following code: 130 134 {{{ 131 135 /var/log/deluge/*.log { … … 138 142 sharedscripts 139 143 postrotate 140 initctl restart deluged >/dev/null 2>&1 || true141 initctl restart deluge-web >/dev/null 2>&1 || true144 systemctl restart deluged >/dev/null 2>&1 || true 145 systemctl restart deluge-web >/dev/null 2>&1 || true 142 146 endscript 143 147 }