Ini adalah cara bodoh untuk check your mysql running atau ngak, lucu tapi it’s work somehow. metode dan cara ini dapat di pakai untuk aplikasi lain bukan hanya mysql
mysqladmin -hlocalhost -uroot -ppower32 status;if [ $? -eq 0 ]; then echo ok; else echo "lets hit mysql";`/etc/init.d/mysql restart`; fi
ok simplenya command diatas akan check apakah mysql hidup atau tidak, kalau hidup dia akan bilang ‘ok’ kalau mati mysql nya di restart. this is only sample, you can do much more like this
awan.bash.keren.sh;if [ $? -eq 0 ]; then echo ok; else echo "you application not run, do something here"; fi
ok just put all off your single line command to crontab and you’re set and ready to sleep and smile