linux shell学习之自动检测并重启httpd服务


linux shell学习之自动检测并重启httpd服务
 
[root@localhost shell]# cat checkapache.sh
 
#!/bin/bash
#using your program to show your system's service
echo "Now,the web service of linux system will be detected..."
echo
#Detect www service
#web=`/usr/bin/pgrep httpd`
web=$(/usr/bin/pgrep httpd)
if [ "$web" != "" ]
then
        echo "The web service is running now."
else
        echo "The web service is NOT running,It Will running Now!"
        /etc/rc.d/init.d/httpd start
fi
 
======================================
将上面的脚本加入计划执行,就可以检测并启动httpd服务了,对网站运维管理特别有用。
 

相关内容

    暂无相关文章