liunx服务器监控脚本(监控nginx,php-fpm,mysql)
#!/bin/bash ip=$(ifconfig eth0 | awk -F'addr:|Bcast' '/Bcast/{print $2}') num=`ps aux | grep php-fpm | grep -v grep | wc -l` if [ $num -eq 0 ];then php alarm.php "php-fpm is not running on $ip" /etc/init.d/php-fpm start fi num=`ps aux | grep nginx | grep -v grep | wc -l` if [ $num -eq 0 ];then php alarm.php "nginx is not running on $ip" /etc/init.d/nginx start fi cmd=`/usr/local/mysql/bin/mysqladmin -h127.0.0.1 -uroot -proot ping` echo "$cmd" | grep -q "alive" if [ $? -ne 0 ];then php alarm.php "mysql is not running on $ip" /etc/init.d/mysql start fi
相关推荐
zhaowj00 2020-07-30
WFMoonlight 2020-08-17
有梦就能实现 2020-06-26
Skyline 2020-06-25
dajiangqingzhou 2020-05-07
olyqcool 2020-05-10
jkzyx 2020-04-25
aaLiweipeng 2020-04-25
aaLiweipeng 2020-04-25
igogo00 2020-03-04
Skyline 2020-03-01
zhaowj00 2020-02-19
amberom 2020-02-18
JF0 2020-02-02
技术渣 2013-05-13
igogo00 2019-12-30
doupoo 2020-01-09