Apache httpd进程监控,自动重启httpd服务shell
2018-02-01 00:00
477 查看
摘要: Apache httpd进程监控shell,让服务永远在线
#!/bin/bash
# Apache httpd进程监控shell
# 如果你在使用RHEL / CentOS / Fedora Linux,使用这个重启命令
RESTART="/sbin/service httpd restart"
# 如果你在使用 Debian / Ubuntu Linux,把上面的RHEL的注释掉,换用这个
#RESTART="/etc/init.d/apache2 restart"
#path to pgrep command
PGREP="/usr/bin/pgrep"
# Httpd daemon name,
# Under RHEL/CentOS/Fedora it is httpd
# Under Debian 4.x it is apache2
HTTPD="httpd"
# Debian / Ubuntu Linux 下进程名是apache2
#HTTPD="apache2"
# find httpd pid
$PGREP ${HTTPD}
if [ $? -ne 0 ] # if apache not running
then
# restart apache
$RESTART
fi
#!/bin/bash
# Apache httpd进程监控shell
# 如果你在使用RHEL / CentOS / Fedora Linux,使用这个重启命令
RESTART="/sbin/service httpd restart"
# 如果你在使用 Debian / Ubuntu Linux,把上面的RHEL的注释掉,换用这个
#RESTART="/etc/init.d/apache2 restart"
#path to pgrep command
PGREP="/usr/bin/pgrep"
# Httpd daemon name,
# Under RHEL/CentOS/Fedora it is httpd
# Under Debian 4.x it is apache2
HTTPD="httpd"
# Debian / Ubuntu Linux 下进程名是apache2
#HTTPD="apache2"
# find httpd pid
$PGREP ${HTTPD}
if [ $? -ne 0 ] # if apache not running
then
# restart apache
$RESTART
fi
相关文章推荐
- 自动监控apache服务状态并重启的shell脚本
- shell实现web服务进程监控并自动重启
- 监控tomcat服务,服务异常时自动重启shell脚本
- 监控php-fpm并自动重启服务的shell脚本
- 【Shell/Python】Linux 进程自动监控bash shell脚本 监控VPS服务器负载/CPU及内存占用 自动重启
- SHELL脚本实现服务宕机监控自动重启
- shell:监控进程运行状态并自动重启进程
- 一个监控Squid运行进程数并自动重启的简洁Shell脚本分享
- 定时 监控 shell 服务宕机自动重启,并发送短信通知
- 如何为一个服务进程创建监控,即使出core也能自动重启
- 用Shell脚本定时监控Linux下的进程状态并自动重启
- apache服务监控脚本-----自动重启apache
- 一个监控Squid运行进程数并自动重启的简洁Shell脚本分享
- shell自动监控重启tomcat脚本
- 监控windows服务,当服务停止后自动重启服务
- python脚本监控进程,服务停止后自动启动
- 关于linux服务器进程监控及自动重启的方法介绍
- 智能监测自动重启Apache服务器的Shell脚本
- 用shell脚本实现监控程序自动重启