用shell脚本监控进程是否存在,不存在则启动的实例:
vim socks-forward.sh
#!/bin/sh
ps -fe|grep 'process name' |grep -v grep
if [ $? -ne 0 ]
then
echo "start....."
#do same thing
echo "done....."
else
echo "runing....."
fi
设置定时任务:
*/10 * * * * sh /disk/server/socks-forward.sh