check_weechat - a small script to keep weechat alive, suitable for crontab
authorEinar Jørgen Haraldseid <einar@haraldseid.net>
Thu, 5 Jun 2014 14:09:11 +0000 (16:09 +0200)
committerEinar Jørgen Haraldseid <einar@haraldseid.net>
Thu, 5 Jun 2014 14:09:11 +0000 (16:09 +0200)
check_weechat [new file with mode: 0755]

diff --git a/check_weechat b/check_weechat
new file mode 100755 (executable)
index 0000000..259d26b
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+# Short script to help keeping weechat alive
+if test $(ps x | grep SCREEN | grep weechat-curses | grep -v grep | wc -l) -gt 0
+then
+       # screen process with ID weechat is running, exit silently
+       exit 0
+else
+       # No screen process with ID weechat is running, restart screen
+       screen -U -d -m -s /bin/bash -S weechat -T screen-256color weechat-curses
+fi