I have several scripts which will run every 10 minutes .
But sometimes the script will not executed properly so end up with a lot of sleep processes.
So I wish to restart mysql every n hours or when there are too many sleep processes , I tried something like
* * * * * /etc/init.d/mysql restart (I know it’s for every minute , but just an example) but not working.
Or is there any other way to prevent sleep processes?Each of my script might run for 8 minutes if there are many data.So i set up cron job for 10 minutes.
Thank you.
First off, as stated by Bjoern above: this should be a temporary workaround as it’s not so much of a solution.
Your problem is that you’re trying to restart your mysql client, rather than the daemon (mysql d), try this instead: