[Unit] Description=rTorrent After=network.target After=openvpn-client@windscribe-denmark [Service] User=root Type=forking KillMode=none ExecStartPre=/usr/bin/bash -c 'if test -e /mnt/video/rtorrent/.session/rtorrent.lock && test -z `pidof rtorrent`; then rm -f /mnt/video/rtorrent/.session/rtorrent.lock; fi' ExecStart=/bin/bash -c 'sleep 10;/usr/bin/screen -dmfa -S rtorrent /usr/bin/rtorrent -b `ifconfig tun0 | grep "inet " | grep -Po "(?<=inet).*(?=net)"`' ExecStop=/usr/bin/bash -c "test `pidof rtorrent` && killall -w -s 2 /usr/bin/rtorrent" WorkingDirectory=/mnt/video/rtorrent Restart=on-failure [Install] WantedBy=default.target