Friday, October 7, 2011

Tomcat: check if process is running

Put this in a cronjob and check every 5 min:

#!/bin/sh

if [ `ps x | grep "java.*" | grep -v grep | grep -vi screen | wc -l` = "0" ]
then
cd /root/my_app
./start > /dev/null &
fi