Stop crond When mysqld is Down

A perl script to stop crond if mysqld is down


#!/usr/bin/perl

# See if MySQL server is alive or not
mysql_status = `/etc/init.d/mysqld status`;
print "MySQL Status:mysql_status\n";
unless(mysql_status =~ /running/) {
	print "Stopping Cron... ";
	#If MySQL is not running, kill the crondcron = `/etc/init.d/crond stop`;
	print $cron;
}

print "\n";
Author: Binny V A
A philosopher programmer who specializes in backend development and stoicism.

Leave a Reply

Your email address will not be published. Required fields are marked *