#!/bin/bash
PGREP="/usr/bin/pgrep"
RESTARTM="/etc/init.d/mysql restart"
MYSQLD="mysqld"
echo $PGREP ${MYSQLD}
if [ $? = 0 ]; then
$RESTARTM
fi
#!/bin/bash
TSTMYSQL=$(/etc/init.d/mysql status | grep stop)
if [ "$TSTMYSQL" = "mysql stop/waiting" ]; then
/etc/init.d/mysql start
fi
entries=`ps -ax | grep $1 | grep -v grep | grep -v checkwbd | wc -l`
host=`/bin/hostname`
_host=${host%%.*}
_date=`/bin/date "+%b %d %T"`
if [ $entries -eq 0 ]; then
cd /usr/local/etc/rc.d
./$2 start
/usr/bin/logger -4 -i -t chkservice -p daemon.info $1 crash detected, process restarted
fi