1

Can't restart mysql from cron job

view story
linux-howto

http://serverfault.com – I have a problem where MySQL (running on Ubuntu 12.04 with all latest updates) dies after a few days so put this script into a cron job that runs as root every 60 seconds. Everything works except the mysql service won't restart, I've tried using "service mysql restart" and "/usr/bin/mysqld" and they don't work either. I am using the full path to restart command so I don't believe that's an issue. Right now the only thing that works is replacing the restart command with a "reboot" and that is very ugly and I want to avoid it. #!/bin/bash #Check if MySQL is up, if not then start it # mysql (HowTos)