Need to crond to restart MySQL and httpd

SupermanInNY

Well-Known Member
Jul 19, 2003
255
0
166
Hi there,

My machine has only 1GB of RAM on it. I ordered 3GB more, but it will be about 10 days till they arrive and get installed.

In the meantime, I have a surge of activity on my server and I'm already using swap.... 50% of the swap!!

You can imagine how terrible the server is acting.

To resolve this problem, (temporarily) I restart two services every 25 minutes:

service mysql restart
service httpd restart

How can I set this to run automatically?
I want the have this run every 20 minutes. This is certainly not a permanent solution, but I have no choice until I get my new memory chips.

Can you walk me through the process of adding a crond to run these services?
I'd like mysql to restart every 20 minutes and httpd every 21 minutes.

I tried to run these as a user using the control panel, but I don't know the correct syntax to make it run.
I placed a file called:

http.sh in my home directory, and called it, but in it, I didn't put the correct syntax. I put the:

service mysql restart

And when the crond ran, the email msg it sent me was: "unknown operation service". So, I need to have a direct call to stop/start mysql using a cron job.

Thanks,

-Alon.
 

SupermanInNY

Well-Known Member
Jul 19, 2003
255
0
166
Yup!

That did the trick!

I was also given the same edit option using: crontab -e (Thanks to Eric Gregory)
and I think it automatically reload the service upon exist.

Anyways, Thanks for the script.

-Alon.