Oh Yeah…rtorrent Needs To Be A Service

It seems I may have left something out when I published the stuff about rtorrent + rutorrent the other day, and that’s the fact if you’re running this in the headless configuration I am, you need to run it as a service. So…here’s what you need to do.

These instructions are actually verbatim from the rtorrent wiki. All I can really add is while they list 16.04..it’s systemd and works just fine with 18.04

sudo apt-get install tmux

Install tmux. After that, you need to create /etc/systemd/system/rtorrent.service

[Unit]
Description=rtorrent (in tmux)

[Service]
Type=oneshot
RemainAfterExit=yes
User=YOUR_USER_ID_WHICH_RUNS_RTORRENT_GOES_HERE
ExecStart=/usr/bin/tmux -2 new-session -d -s rtorrent rtorrent
ExecStop=/usr/bin/tmux kill-session -t rtorrent

[Install]
WantedBy=default.target

Then enable the service and start it up.

sudo systemctl enable rtorrent.service
sudo systemctl start rtorrent.service