AI智能
改变未来

进程监控 shell Linux 脚本


shell 脚本 实现进程监控

[code]#!/bin/shhost_dir=/home/www/computer-visionworker=1for((i=1;i<= ${worker} ;i++));doproc_name=\"ASES${i}\"file_name=\"monitor.log\"pid=0proc_num()          {    num=`ps -ef | grep $proc_name | grep -v grep | wc -l`    return $num}proc_id()      {    pid=`ps -ef | grep $proc_name | grep -v grep | awk \'{print $2}\'`}proc_numnumber=$?if [ $number -eq 0 ]then    `rm -rf ${host_dir}/${proc_name}`    cp -rf ${host_dir}/ASES ${host_dir}/${proc_name}    cd $host_dir/${proc_name}/    mv ASES_p0 ${proc_name}        nohup ./${proc_name} &     echo \'start\'    proc_id    echo ${pid},${proc_name} `date` >> $host_dir/$file_namefidone

 

 

赞(0) 打赏
未经允许不得转载:爱站程序员基地 » 进程监控 shell Linux 脚本