learning shell monitor prog function

Posted 良红

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了learning shell monitor prog function相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章

论文研读《Deep Learning and Its Applications to MachineHealth Monitoring: A Survey》

[shell] Monitor CPU or Memory

[shell] Monitor CPU or Memory

lite-monitor 一款基于shell命令的监控系统

Linux/Unix shell 监控Oracle实例(monitor instance)

Linux/Unix shell 监控Oracle监听器(monitor listener)