My program(interphone_manager) has encountered a situation that when it is on WAN it's connection sometimes fail to connect to pjsip service. Then the program will quit. Thus I wrote a demons for restarting it when it smell interphone_manager's process doesn't exist.
The shell program is as follow.
#!/bin/sh
while true
do
ps -ef | grep "$PWD/resource/bin/interphone_manager" | grep -v "grep"
if [ "$?" -eq 1 ]
then
$PWD/interphone_manager
echo "process has been restart!"
else
echo "process already started!"
fi
sleep 3
done
本文介绍了一个shell脚本,用于监测Interphone Manager进程,当该进程因连接pjsip服务失败而退出时,自动重启该服务。通过循环检查进程是否存在,如果不存在则启动Interphone Manager并记录重启信息。
16万+

被折叠的 条评论
为什么被折叠?



