PDA

View Full Version : mysql cron


rldev
08-30-2006, 11:45 AM
Can someone post a cron entry to properly stop and start mysql say once a day?

vandal
08-31-2006, 03:32 PM
on redhat systems simply:

0 * * * * /sbin/service mysql restart

would restart it every hour.

rldev
08-31-2006, 03:36 PM
strange their is no restart on my RHE system. Just start and stop.

vandal
08-31-2006, 03:38 PM
that is odd, you should have restart. what does "service mysql" from root output?

rldev
08-31-2006, 06:13 PM
unrecognized service.

vandal
08-31-2006, 07:54 PM
service mysqld ?

rldev
09-01-2006, 07:35 AM
yes

/etc/init.d/service mysqld

but this doesn't work from cron:

/etc/init.d/service: No such file or directory

How do I execute the command?

I have:

0 */12 * * * /etc/init.d/service mysqld restart

Mik3yZ
09-01-2006, 07:46 AM
why the slash in front of 12?

0 * 12 * * * service mysqld restart

or

0 * 12 * * * /etc/init.d/service mysqld restart

rldev
09-01-2006, 08:05 AM
I want to run it every 12 hours. The cron kicks back the following email when running:

/bin/sh: service: command not found

What's the problem?

rldev
09-02-2006, 10:11 AM
anyone?

selfwebhosting
06-22-2007, 05:14 PM
In my case it is...

/sbin/service mysqld restart

I am using Fedora 4 OS.