1. /etc/inittable里面添加
2.写一个简单的脚本实现:
定时去查询守护进程在不在
不再就自动重启。
更为保险的做法是两个进程相互监视,如果对方挂掉就重启。两个进程都挂掉的概率还是比较低
#!/bin/sh
while true
do
ps -ef | grep -e "test" | grep -v grep
if [ "$?" -eq 0] ; then
./test
fi
sleep 1
done
1. /etc/inittable里面添加
2.写一个简单的脚本实现:
定时去查询守护进程在不在
不再就自动重启。
更为保险的做法是两个进程相互监视,如果对方挂掉就重启。两个进程都挂掉的概率还是比较低
#!/bin/sh
while true
do
ps -ef | grep -e "test" | grep -v grep
if [ "$?" -eq 0] ; then
./test
fi
sleep 1
done