Shell之定时拉起脚本
来源:互联网 发布:带着淘宝混异界腐书 编辑:程序博客网 时间:2024/06/08 02:13
## 定时拉起脚本scan_shell.sh
#!/bin/sh######################################################################################### Define app execute command here.(please type full name of programs and args)########################################################################################appcmds[0]='/usr/test/app/cmdwifi'appcmds[1]='/usr/test<span style="font-family: Arial, Helvetica, sans-serif;">/app/server_cma_module'</span>appcmds[2]='/usr/test/app/logmodule_server'appcmds[3]='/usr/test/app/bitemodule_server'appcmds[4]='/usr/test/app/proxydb'appcmds[5]='/usr/test/app/server_suu'appcmds[6]='/usr/test/app/seat_control'appcmds[7]='/usr/test/app/relay_module'appcmds[8]='/usr/sbin/named -u named'appcmds[9]='/usr/sbin/dhcpd eth1'appcmds[10]='/opt/lampp/sbin/mysqld'appcmds[11]='/opt/lampp/bin/httpd'appcmds[12]='/usr/donica/app/ku_cma'LOG_FILE='/usr/donica/script/scanproc.log'#sleep 60cd /usr/donica/script/mv scanproc.log scanproc.log.last######################################################################################### Caution: please DO NOT modify the scripts below.#########################################################################################check app command if exist.for cmd in "${appcmds[@]}"; do filename=$(echo $cmd|awk '{print $1}') echo ">> Checking sh file: app command - " $cmd if [ -f "$filename" ]; then echo ">> SUCCESS~~~~" else echo ">> FAILED!!!! please make sure app command exist." exit fidonecheckprocess(){ script_name=$(basename $0) if [ "$1" = "" ]; then return 1 fi process_num=$(ps -ef |grep "$1" |grep -v "grep" | grep -v $script_name | wc -l) return $process_num}########################################################################################Some process need to read config file,we must use correct path######################################################################################cd /usr/donica/app/echo ">> Checking process status..."nums=${#appcmds[*]}while [ 1 ] ; do for((i=0; i<nums; i++)); do appcmd=${appcmds[i]} # get app name from app cmd appname=${appcmd%% *} appname=${appname##*/} $(checkprocess $appname) check_result=$? if [ $check_result -eq 0 ]; then set `date` printf ">> ["$appname"] DOWN. Trying to start it!" echo "["$2" "$3" "$4" "$6"] ["$appname"] DOWN. Trying to start it!" >> $LOG_FILE########################################################################################Because of some system services, we should use different start command to start them####################################################################################### if [ $i -eq 8 ];then printf "\n" service named start elif [ $i -eq 9 ];then printf "\n" service dhcpd start
0 0
- Shell之定时拉起脚本
- 服务自动拉起,定时日志清理,数据统计的shell脚本
- Shell脚本实现进程的自动拉起
- Shell脚本之crontab定时任务
- Shell脚本之crontab定时任务
- Shell脚本之crontab定时任务
- Shell脚本监控、拉起Nimbus和Supervisor进程
- Linux定时shell脚本
- shell 代码 进程监控脚本,拉起core dump的服务器进程,以维持服务稳定
- shell脚本实现监控某个进程意外停止后拉起进程
- linux 定时执行shell脚本 定时任务
- linux 定时执行shell脚本
- linux 定时执行shell脚本
- crontab 定时执行shell脚本
- crontab 定时执行shell脚本
- linux 定时执行shell脚本
- linux 定时执行shell脚本
- linux 定时执行shell脚本
- UIScrollView实现图片轮播器的无限滚动
- IOS工程自动打包并发布脚本实现
- Core Animation 3D介绍(第2部分)
- jmeter 监听器
- Apache启用mod_deflate的gzip压缩
- Shell之定时拉起脚本
- 怎么用clementine做关联规则分析
- 字符串之间比较大小(可转化为对象)
- Android应用加入微信分享
- 去掉字符里的html标签
- maven导出项目依赖的jar包
- jsp页面防止刷新重复提交解决方案
- 常用js特效之左上角菜单
- 页面设计