aboutsummaryrefslogtreecommitdiffstats
path: root/hyperbot_fixer
diff options
context:
space:
mode:
Diffstat (limited to 'hyperbot_fixer')
-rwxr-xr-xhyperbot_fixer24
1 files changed, 24 insertions, 0 deletions
diff --git a/hyperbot_fixer b/hyperbot_fixer
new file mode 100755
index 0000000..3647660
--- /dev/null
+++ b/hyperbot_fixer
@@ -0,0 +1,24 @@
+#! /bin/bash
+
+while true
+do
+ sleep 30m
+
+ # If nothing has been written to the log for 30 minutes then we assume
+ # hyperbot is dead.
+ if [[ -z $(find logs/ -iname 'raw.log' -mmin -30) ]]
+ then
+ # Kill all hyperbot processes
+ while read -r line
+ do
+ # If it's not the pid of this process then kill it.
+ [[ "${line}" != "$$" ]] && kill "${line}" &>/dev/null
+ done < <( pgrep -u hyperbot )
+
+ # Start hyperbot
+ cd /srv/hyperbot
+
+ ./envbot &
+ ./issues_change_detector &
+ fi
+done