Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have 2 webservers and 5 mysql servers. Our website has a lot of traffic and one of the mysql servers goes down or gets flooded and i need to restart it (/etc/init.d/mysql restart).

Can i do it via PHP script (runing ssh command via php or something?)

Thank you

share|improve this question
add comment

1 Answer

You can, but its probably not a very good idea. You're better off installing something like nagios, monit, or god to monitor your mysql instance and restart it if it fails.

The biggest problem with exposing a php script like that is that it would need to run with root privileges to run any init script. So while I'm sure you could password protect it and hide it well, its just not a wise choice when there are monitoring tools that can automatically restart a failed service.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.