WhatPulse Forums
script to check if running or not - Printable Version

+- WhatPulse Forums (http://whatpulse.org/forums)
+-- Forum: Support (/forumdisplay.php?fid=38)
+--- Forum: Client software (/forumdisplay.php?fid=58)
+--- Thread: script to check if running or not (/showthread.php?tid=3174)



script to check if running or not - Sc0rian - 07-09-2013 02:00 PM

I am wondering if anyone has written a script to check if the whatpulse client is running, and if it is not to start it.

My whatpulse client quite often does not start, and even locks up. I have to kill it and start it again. It's a real shame, I love whatpulse but I really wish they get it working better on Ubuntu.

I wrote a simple script, which works when I run it, but when I insert it into a cronjob it won't. I have tried putting my username before the cronjob etc, but just will not work. Thinking maybe to install monit, but a bit overkill just for WP.

Code:
#!/bin/sh

RESULT=`ps -A | sed -n /whatpulse/p`

if [ "${RESULT:-null}" = null ]; then
    echo "whatpulse not running    "
    screen -d -m /home/me/.whatpulse-bin/whatpulse
else
    echo "whatpulse running"
fi