今天寫了一個(gè)腳本監(jiān)控beidouchaind這個(gè)進(jìn)程是否存,如果存在就返回信息并寫入日志文件,否則就啟動(dòng)
-
#!/bin/sh
-
ps -fe|grep beidouchaind |grep -v grep
-
if [ $? -ne 0 ]
-
then
-
echo ">>>>no beidouchain,run it." `date` >> /root/beidouchain.log
-
/usr/local/bin/beidouchaind corechain@192.xxx.1.xx:7179 -daemon
-
else
-
echo ">>>>beidouchain is running." `date` >> /root/beidouchain.log
-
fi
在crontab里設(shè)置,每分鐘調(diào)用一次
-
* * * * * sh /root/monitor_beidouchain_process.sh