Purpose

       Shell script monitor prog function

 

Eevironment

       Ubuntu 16.04 bash env

 

Procdeure

  Source code:

#!/bin/bash

while [ 1 ]
do
# get under /appServer/app directory prog numbers
nprogs=`ls -t /appServer/app | cut -d" " -f1 | wc -l`
#echo $nprogs if [ $nprogs -eq 0 ]
then
echo "not progs" > /dev/null
else
#echo "judge driver running status"
for i in `seq 1 $nprogs`
do
#echo $i
prog=`ls -t /appServer/app | cut -d" " -f1 | head -n"$i" | tail -n1`
#echo $prog
ps -ef | grep "$prog" | grep -q -v grep
if [ $? -ne 0 ];then
#/appServer/app/$prog > /dev/null &
/appServer/app/$prog &
fi
done
fi sleep 60 done

  

 

learning shell monitor prog function的更多相关文章

  1. learning shell display alert function

    [Purpose]        Shell print function base on err info wrn ext output level   [Eevironment]        U ...

  2. learning shell built-in variables (1)

    Shell built-in variables [Purpose]        Learning shell built-in variables, example $0,$1,$2,$3,$#, ...

  3. learning shell args handing key=value example (2)

    Shell args handing key=value example [Purpose]        Learning how to handing ker=value args   [Eevi ...

  4. learning shell script prompt to run with superuser privileges (4)

    Shell script prompt to run with superuser privileges [Purpose]        Check whether have root privil ...

  5. learning shell get script absolute path (3)

    Shell get script absolute path [Purpose]        Get shell script absolute path   [Eevironment]       ...

  6. learning shell check requires root privileges

    [Purpose]        Shell script check requires root privileges   [Eevironment]        Ubuntu 16.04 bas ...

  7. learning shell check host dependent pkg

    [Purpose]        Shell script check host dependent pkg   [Eevironment]        Ubuntu 16.04 bash env ...

  8. Unsupervised Learning: Use Cases

    Unsupervised Learning: Use Cases Contents Visualization K-Means Clustering Transfer Learning K-Neare ...

  9. shell 实例

    转载自:https://github.com/liquanzhou/ops_doc    这里只作为笔记使用,不做他用 shell实例手册 0 说明{ 手册制作: 雪松 更新日期: 2018-09-1 ...

随机推荐

  1. HTML的attribute和DOM的property剖析(转)

    原文:https://www.jianshu.com/p/efc704d713c7 HTML attribute 与 DOM property 的对比 该文摘自angular的官方文档,老外对概念的解 ...

  2. bootstrap table--面相配置、hook、适配的表格框架

    bootstrap table--面相配置.hook.适配的表格框架

  3. Java自学-操作符 关系操作符

    Java的关系操作符 关系操作符:比较两个变量之间的关系 > 大于 >= 大于或等于 < 小于 <= 小于或等于 == 是否相等 != 是否不等 示例: public clas ...

  4. 并发编程--一堆锁,GIL,同步异步,Event事件

    目录 一堆锁 死锁现象(*****) 递归锁 RLock (了解) 信号量 (了解) GIL(*****) 什么时GIL锁 为什么需要GIL锁 Cpython解释器与GC的问题 GIL锁带来的问题 多 ...

  5. SAP CDS redirect view支持写操作吗,一个实验来验证

    According to this wiki, write back on CDS view is not supported: And also it is defined in ABAP help ...

  6. 【转】学习ARM为什么首选IMAX6??

    ARM作为目前嵌入式行业主流的架构,已经让越来越多从事电子行业的朋友了解,并且高校对于嵌入式的学习,很多直接从ARM开始,目前ARM的嵌入式培训也越来越多,足以说明现在嵌入式行业有多火.目前主流的AR ...

  7. 【Spring Boot】Spring Boot之五种容器启动后进行相关应用初始化操作方法

    一.方式一,使用ApplicationListener<E extends ApplicationEvent>监听ContextRefreshedEvent事件 /** * @author ...

  8. SAMBA配置文件详解

    全局参数: ==================Global Settings =================== [global] config file = /usr/local/samba/ ...

  9. SSH爆破应急响应

    问题发现 登录云主机,根据提示消息,发现正遭受SSH爆破攻击,IP地址为159.65.230.189 查看登录相关安全日志:tail -f /var/log/secure,发现其他尝试爆破IP106. ...

  10. Nginx的特性功能-反向代理、负载均衡、缓存、动静分离、平滑升级

    反向代理 nginx配置文件 events  {   }  事件驱动 httpd  {   }   关于httpd相关的配置 server {  }  定义虚拟主机 location {   }    ...