Answer the question
In order to leave comments, you need to log in
How to automatically start MYSQL on crash in UBUNTU?
Tried like this
#!/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
Answer the question
In order to leave comments, you need to log in
Many, many years ago, I wrote this to test for a crash in the winbind process. Starts on the crown.
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
Perhaps the immortal utility will help in this matter: https://immortal.run
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question