Results 1 to 5 of 5
Hey guys,
i need some help in my server... its CentOS (redhat alike).
i need to make the server disable apache server then run mysql command to optimize the databases ...
- 09-15-2010 #1Just Joined!
- Join Date
- Sep 2010
- Posts
- 4
Cron Jobs !!?
Hey guys,
i need some help in my server... its CentOS (redhat alike).
i need to make the server disable apache server then run mysql command to optimize the databases then re-enable apache server in a specific time daily.
it it possible?
regards.
Ali
- 09-15-2010 #2Just Joined!
- Join Date
- Aug 2010
- Posts
- 89
Sure, do your job in a bash scripts :
e.g.
/root/myscript.sh
#!/bin/sh
service httpd stop
mysql ......
service httpd start
Make your script executable :
chmod +x /root/myscript.sh
Then, call your scripts from crontab
/etc/crontab (e.g. everyday at 10:01 AM):
01 10 * * * root /root/myscript.sh
Then, "service crond restart"
- 09-15-2010 #3Just Joined!
- Join Date
- Sep 2010
- Posts
- 4
- 09-17-2010 #4Just Joined!
- Join Date
- Aug 2010
- Posts
- 89
There is no problem here. Apache don't realy wait as it's stopped. The shell scripts wait the end of the mysql command, then it startup again apache, even some hour later if needed.
You can do another script to start but it will not be sure, as if time is too late you have unecessary downtime and if it's too early you'll start before the end of your command...
- 09-17-2010 #5Just Joined!
- Join Date
- Sep 2010
- Posts
- 4


Reply With Quote
