+#!/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