想做2套预防机制,用cronjob每5分钟检测一次,当apahce和mysql死机时,自动重启1. mysql死机重启:
但是怎么样的mysql查询语句,可以判断出mysql已经死机状态,然后运行service mysql restart?<?php
if(mysql死机){
 $output=shell_exec('service mysql restart');
 echo $output;
 exit;
}
?>2. apache死机重启:
想用curl模拟打开自己网站的一个页面,如果头部返回信息为500,则service httpd restart
但是apache已经死掉了,curl都无法运行了。求可行的方案及代码。谢谢各位大虾了。