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