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. python安装pyautogui

    一.问题在安装使用[pip install pyautogui]的时候会出现如下的错误: ERROR: Complete output from command python setup.py egg ...

  2. Java学习:switch语句使用的注意事项

    switch语句使用的注意事项: 多个case后面的数值不可以重复. switch后面的小括当中只能是下列数据类型: 基本数据类型:byte/short/char/int 引用数据类型:String字 ...

  3. 彻底搞懂Javascript的this

    在Javascript中,最玄妙的特性之一,就是this的指向玄幻莫测,一会儿指向这一会儿指向那,让初学者十分伤脑筋. 本文总结一下,方便初学者掌握奥妙之处,同时方便老鸟温故而知新. 首先,看一段代码 ...

  4. 在Eclipse中使用Beyond Compare做为比较工具

    1.下载org.eclipse.externaltools-Update-0.8.9.v201003051612.zip插件包 接下来,要下载Beyond Compare的插件,http://beyo ...

  5. MATLAB datenum日期转换为Python日期

    摘要 MATLAB datenum时间格式参数众多,本文只简单关注 units 参数,即基准年份和计时度量(天.小时). 命令行演示在 ipython 和 Octave 中进行. 示例1:小时制,基准 ...

  6. SQL Server中查找包含某个文本的存储过程 SQL 查找存储过程中出现过的文字怎么查询 查询整个数据库中出现的文本 sql 全局搜索

    --将text替换成你要查找的内容SELECT name, *FROM sysobjects o, syscomments sWHERE o.id = s.id AND text LIKE '%tex ...

  7. NodeJS新建服务器以及CommonJS规范

    1.什么是node.js?(1)Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境.Node.js 使用了一个事件驱动.非阻塞式 I/O 的模型,使其轻量又高效.( ...

  8. js学习之面向对象

    一.创建对象的方法 1. {} 字面量创建 var person ={ name: "lisi", age: , say: function(){ alert(this.name) ...

  9. SpringCloud之监控数据聚合Turbine

    前言 SpringCloud 是微服务中的翘楚,最佳的落地方案. 使用 SpringCloud 的 Hystrix Dashboard 组件可以监控单个应用服务的调用情况,但如果是集群环境,可能就 不 ...

  10. Java集合学习(6):LinkedHashSet

    一.概述 首先我们需要知道的是它是一个Set的实现,所以它其中存的肯定不是键值对,而是值.此实现与HashSet的不同之处在于,LinkedHashSet维护着一个运行于所有条目的双重链接列表.此链接 ...