Torrents rechecking on every reboot
Hi,
I've installed this script on Ubuntu 16.04 LTS and I'm having an issue where everytime I reboot the server all torrents get rechecked.
What could be the cause? Thanks.
Solved this by switching rTorrent's startup method from Crontab to a Systemd service file.
The issue was most likely being caused by the server not closing rTorrent graciously (when ordered to reboot or shutdown) therefore the rtorrent.lock file wasn't removed and that caused the rehashing of torrents on startup.
Had to include a command on the systemd service file to remove the rtorrent.lock before rtorrent was started.
By the way, I also switched Irssi startup method to Systemd as I prefer it that way. This is what I did:
1. Removed rTorrent and Irssi entries from the Crontab:
If you didn't add any more entries besides the ones created by this script):
crontab -r
If you added any crontab entries, just edit it and remove both lines manually:
crontab -e
2. Created Systemd service files for rTorrent and Irssi (replace USERNAME with the user intended):
sudo nano /etc/systemd/system/rtorrent.service
`[Unit] Description=rTorrent After=network.target
[Service] Type=forking KillMode=none User=USERNAME ExecStartPre=/bin/rm -f /home/USERNAME/rtorrent/.session/rtorrent.lock ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent WorkingDirectory=%h
[Install] WantedBy=multi-user.target`
sudo nano /etc/systemd/system/irssi.service
`[Unit] Description=Irssi After=network.target
[Service] Type=forking KillMode=none User=USERNAME ExecStart=/usr/bin/screen -dmS irssi irssi ExecStop=/usr/bin/screen -S irssi -X quit WorkingDirectory=%h
[Install] WantedBy=multi-user.target`
sudo systemctl enable rtorrent.service
sudo systemctl enable irssi.service