View Single Post
  #9  
Old 08-03-2007, 03:12 PM
PSS PSS is offline
Senior Member
 
Join Date: Jun 2007
Posts: 126
I check if memcached is up with this small script I made (I'm not daily bash coder, feel free to improve), I run it every minute with cron. If you do the same for LS main process you can have reasonably good kickstarter in case all LS processes die.

Code:
#!/bin/sh
pid=`ps --user=nobody | grep memcached | awk '{print $1}'` 

if kill -0 $pid 2> /dev/null ; then
    exit 0
else
    echo memcached process not found, restarting...
    /usr/local/bin/memcached -u nobody -d -m 128 -l 127.0.0.3 -p 11211
    sleep 2
    pid=`ps --user=nobody | grep memcached | awk '{print $1}'`
    if kill -0 $pid 2> /dev/null ; then
      echo process $pid ok
    fi
fi
exit 0
Reply With Quote