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. Direct Buffer介绍

    Direct Buffer 前言 上篇文章Buffer末尾中谈到堆内Buffer(Heap Buffer)和直接Buffer(Direct Buffer)的概念,但是却一笔带过,并未涉及其细节,这篇文 ...

  2. tqdm()与set_description()的用法

    pbar=tqdm(range(55156))for i in pbar: # print(i) a=464443161*845113131 pbar.set_description("tr ...

  3. Trie树的java实现

    leetcode 地址: https://leetcode.com/problems/implement-trie-prefix-tree/description/ 难度:中等 描述:略 解题思路: ...

  4. VUE组件1

    1.组件基础 通过import引入.vue的文件,在componet中注册,在template中使用. 2.数据,方法和计算属性 注意点: 因为组件是用来复用的,且 JS 里对象是引用关系,如果组件中 ...

  5. js浏览器对象模型【BOM】(十三)

    一.时间定时器1.超时调用setTimeout(fun,time)    [返回一个唯一标识该超时调用的ID数值]参数:fun:要执行的函数time:设置第多少毫秒后执行fun函数 clearTime ...

  6. 85.webpack的安装失败至成功

    webpack怎么安装 1.安装node.js; 2.安装webpack:   npm install webpack --save-dev   : 注意:webpack 4x以上,webpack将命 ...

  7. 冬虫夏草winterwormsummerherb英语

    “中药之王”--冬虫夏草WinterwormSummerherb King of Chinese medicine --WinterwormSummerherb “冬天是虫,夏天是草,冬虫夏草是个宝. ...

  8. mysql编译安装下载地址(官网)

    https://dev.mysql.com/get/Downloads/MySQL-version number/mysql-version number.tar.gz 把这个地址上面的版本号改成自己 ...

  9. MYSQL中的时间类型

    时间上总共有五中表示方法:它们分别是 time.date.datetime.timestamp和year. time :  “hh:mm:ss”格式表示的时间值,格式显示TIME值,但允许使用字符串或 ...

  10. FreeRTOS 任务通知模拟消息邮箱

    举例 void task1_task(void *pvParameters) { u8 key; BaseType_t err; while(1) { key=KEY_Scan(0); //扫描按键 ...