From 4160f10ebeab6bb33a91e69d9c783e0aeef8bbe9 Mon Sep 17 00:00:00 2001
From: ejparker <ejparker@actcur.com>
Date: Sun, 12 May 2019 22:00:11 -0500
Subject: [PATCH] restart rtorrent every 6 hours

---
 states/roles/maintain/rtorrent/rtorrent.service | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/states/roles/maintain/rtorrent/rtorrent.service b/states/roles/maintain/rtorrent/rtorrent.service
index 3c890a2..e9198d9 100644
--- a/states/roles/maintain/rtorrent/rtorrent.service
+++ b/states/roles/maintain/rtorrent/rtorrent.service
@@ -5,13 +5,14 @@
 
     [Service]
     User=root
-    Type=forking
+    Type=notify
     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
+    WatchdogSec=420
+    Restart=always
 
     [Install]
     WantedBy=default.target
\ No newline at end of file