Created
May 13, 2020 21:27
-
-
Save glance-/4c5f7921c760cc12b0266070a97e0391 to your computer and use it in GitHub Desktop.
rtorrent / screen / systemd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If we're running with the right systemd env, run our heartbeat to systemd. | |
execute2={/bin/systemd-notify,--ready} | |
execute2={/bin/bash,-c,systemd-notify MAINPID=`ps -p "$\{1:-$$\}" -o ppid= | tr -d " "`} | |
execute2={/bin/systemd-notify,WATCHDOG_USEC=480000000} | |
schedule=systemd_watchdg, 10, 60, "execute2={/bin/systemd-notify,WATCHDOG=1}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=rTorrent | |
After=network.target | |
[Service] | |
Type=forking | |
WatchdogSec=600 | |
Restart=on-failure | |
NotifyAccess=all | |
Environment=LANG=en_US.UTF-8 | |
ExecStartPre=-/bin/rm %h/.rtorrent-sessions/rtorrent.lock | |
# IOnice just rtorrent, not anything related in that screen | |
# dump scrollback from screen into a file upon rtorrent exit, and remove the empty lines which ends up there, and put that into journal. | |
ExecStart=/usr/bin/screen -dmS rtorrent bash -c 'trap "" ABRT ; /usr/bin/ionice -c 3 /usr/bin/nice -n 19 %h/bin/rtorrent ; screen -X hardcopy -h /run/user/%U/rtorrent.$$$$ ; sed '/^$/d' /run/user/%U/rtorrent.$$$$ | logger -t rtorrent-hardcopy ; rm -f /run/user/%U/rtorrent.$$$$ ; screen -X exit' | |
ExecStop=/bin/kill -INT $MAINPID | |
ExecStop=/usr/bin/timeout 60 tail --pid=${MAINPID} -f /dev/null | |
WorkingDirectory=%h | |
[Install] | |
WantedBy=default.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment