I have been unable to get tmux & rtorrent running with a systemd service file. My rtorrent.service
:
[Unit]
Description=rTorrent
Documentation=https://github.com/rakshasa/rtorrent
After=network.target local-fs.target
[Service]
Type=forking
KillMode=none
User=rtorrent
ExecStart=/usr/bin/tmux -S /tmp/rtorrent.sock new-session -d -s rtorrent \'rtorrent -n -O import=/etc/rtorrent.rc\'
ExecStop=/usr/bin/tmux -S /tmp/rtorrent.sock send-keys -t rtorrent C-q
WorkingDirectory=/home/rtorrent
[Install]
WantedBy=default.target
(Using Type=oneshot
with RemainAfterExit=yes
did not work, and I'm not convinced that is a solution anyway. I think running tmux
this way ought to be done with Type=forking
. Please correct me if I'm wrong!)
The output from systemctl status rtorrent
:
● rtorrent.service - rTorrent
Loaded: loaded (/etc/systemd/system/rtorrent.service; disabled)
Active: failed (Result: exit-code) since Mon 2015-04-27 10:48:37 AEST; 22s ago
Docs: https://github.com/rakshasa/rtorrent
Process: 4433 ExecStart=/usr/bin/tmux -S /tmp/rtorrent.sock new-session -d -s rtorrent 'rtorrent -n -O import=/etc/rtorrent/rtorrent.rc' (code=exited, status=1/FAILURE)
Apr 27 10:48:37 vagrant tmux[4433]: usage: new-session [-AdDP] [-c start-directory] [-F format] [-n window-name] [-s session-name] [-t target-session] [-x width] [-y height] [command]
Apr 27 10:48:37 vagrant systemd[1]: rtorrent.service: control process exited, code=exited status=1
Apr 27 10:48:37 vagrant systemd[1]: Failed to start rTorrent.
Apr 27 10:48:37 vagrant systemd[1]: Unit rtorrent.service entered failed state.
Switching to the rtorrent
user with su
allows me to try the ExecStart
command manually - which works fine. I'm at a loss to debug this further.
Thoughts? Thanks!
tmux
, so just use quotes as you normally would.