在chinaunix上问了很久没找到解决方案
自己动手丰衣足食
脚本如下
#!/bin/bash
c=$(ps -ef|grep python |grep -v "grep"|wc -l)
if [ $c -lt 1 ]
then
python /home/spider/spider.py &
fi
保存文件名为 xxx.sh
运行命令 :crontab -e
在 nano里面 添加
*/分钟 * * * * sh 文件的路径
ctrl+x
Y
回车
/etc/init.d/cron restart

浙公网安备 33010602011771号