From: Einar Jørgen Haraldseid Date: Thu, 5 Jun 2014 14:09:11 +0000 (+0200) Subject: check_weechat - a small script to keep weechat alive, suitable for crontab X-Git-Url: https://git.slaskete.net/einar-bin/commitdiff_plain/786a748526ff8b83773ad389dc37a3f87944d526 check_weechat - a small script to keep weechat alive, suitable for crontab --- diff --git a/check_weechat b/check_weechat new file mode 100755 index 0000000..259d26b --- /dev/null +++ b/check_weechat @@ -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