linux 监视端口是否正常的shell脚本
(编辑:jimmy 日期: 2024/11/25 浏览:3 次 )
复制代码 代码如下:
#!/bin/bash
port=”80″
restart=”/etc/init.d/httpd restart”
EMAIL=”/bin/echo selboo | mutt -s "重新启动httpd" root@selboo.com.cn”
netstat -ln |awk ‘/^tcp/ {print $4}' |grep -q “:$port$” || {
#reboot httpd
eval $restart;$EMAIL
exit $?
}
exit 0
#!/bin/bash
port=”80″
restart=”/etc/init.d/httpd restart”
EMAIL=”/bin/echo selboo | mutt -s "重新启动httpd" root@selboo.com.cn”
netstat -ln |awk ‘/^tcp/ {print $4}' |grep -q “:$port$” || {
#reboot httpd
eval $restart;$EMAIL
exit $?
}
exit 0
下一篇:VPS自动备份数据库到FTP的脚本代码