#!/bin/bash process_name=app-0.0.1-SNAPSHOT.jar while [ 1 ] do time=`date` serverpid=`ps -ef|grep $process_name|grep -v grep|awk '{print $2}'` if [ "$serverpid" ];then echo $time" $process_name process is running , pid is $serverpid " >> /tmp/app_process_monitor.log else echo $time" $process_name process is not running, now starting ..." >> /tmp/app_process_monitor.log cd /home/app && sh app_start.sh start fi sleep 60 done
啟動monitor進(jìn)程 sh /home/app_process_monitor.sh & > /dev/null 2>&1
本文摘自 :https://www.cnblogs.com/