linux Web服务程序监控shell脚本
来源:互联网 发布:各类化验单制作软件 编辑:程序博客网 时间:2024/04/30 06:39
#!/bin/bash
pgrep=/usr/bin/pgrep
killall=/usr/bin/killall
nohup=/usr/bin/nohup
curl=/usr/bin/curl
sleep=/bin/sleep
service=CC
host=127.0.0.1
port=8080
count=0
max=4
check_web(){
while :
do
check_pid
result=$($curl http://$host:$port/android_ping)
echo "result:$result"
if [ "$result" ] ; then
count=0
else
let count+=1
echo "exception:$count"
if [ $count -gt $max ] ; then
$killall -9 $service && $nohup /home/CC/CC $port &
count=0
fi
fi
$sleep 3
done
}
check_pid(){
if [ -n "`$pgrep $service`" ] ; then
echo "CC service was already started by another way"
else
echo "CC service was not started"
echo "Starting service ..."
$nohup /home/CC/CC $port &
echo "CC service was exited!"
fi
}
check_web
pgrep=/usr/bin/pgrep
killall=/usr/bin/killall
nohup=/usr/bin/nohup
curl=/usr/bin/curl
sleep=/bin/sleep
service=CC
host=127.0.0.1
port=8080
count=0
max=4
check_web(){
while :
do
check_pid
result=$($curl http://$host:$port/android_ping)
echo "result:$result"
if [ "$result" ] ; then
count=0
else
let count+=1
echo "exception:$count"
if [ $count -gt $max ] ; then
$killall -9 $service && $nohup /home/CC/CC $port &
count=0
fi
fi
$sleep 3
done
}
check_pid(){
if [ -n "`$pgrep $service`" ] ; then
echo "CC service was already started by another way"
else
echo "CC service was not started"
echo "Starting service ..."
$nohup /home/CC/CC $port &
echo "CC service was exited!"
fi
}
check_web
0 0
- linux Web服务程序监控shell脚本
- linux shell 监控web服务
- 开发监控Web 服务的Shell脚本
- shell脚本---web监控脚本系列
- linux shell脚本-监控进程
- linux shell脚本监控端口
- shell监控Linux服务进程
- 监控Nginx服务的Shell脚本
- 监控tomcat服务自动重新启动shell脚本
- 使用curl脚本监控web服务状态
- jprofiler 监控java程序的shell脚本
- jprofiler 监控java程序的shell脚本
- linux下shell 网速监控脚本
- Linux常用的系统监控shell脚本
- Linux常用的服务器监控shell脚本
- Linux常用的主机监控shell脚本
- linux服务器系统负载监控-shell脚本
- linux服务器系统cpu监控-shell脚本
- Xshell 注册密钥
- 【ZOJ3261】【离线并查集】【逆序】【好题】
- java进行多张图片组合一张图片
- Atitit.使用引擎加脚本架构的设计 使用php,js来开发桌面程序。。
- Activity 启动模式以及Inent Flags理解
- linux Web服务程序监控shell脚本
- [leetcode] 99.Recover Binary Search Tree
- C Looooops(扩展欧几里得求模线性方程)
- EdtText默认显示数字键盘,不强制输入数字
- python学习笔记
- 各类排序算法性能对比简述
- atitit.jquery tmpl模板总结 .doc
- 使用 Sahi 实现 Web 自动化测试
- sscanf