keeper.sh simple daemon

! # / bin / SH 

the while  to true ; do 
        # start a cycle, regularly check whether the process exists 
        Server = ` PS the AUX | grep / opt / MongoDB | grep -v grep `
         IF [! " $ Server " ]; the then 
           echo ` DATE  " +% Y-M-% D%% H:% M:% S " `the restart-Service 
            # if there is no re-start 
            the nohup bin / the mongod --dbpath / opt / MongoDB / DB> mongodb.nohup.out & 
            # start after her 10s 
            SLEEP  10 
        Fi 
        # 2s sleep per cycle
        sleep 2
done

 

 

Guess you like

Origin www.cnblogs.com/zhaohz/p/12117164.html