自动检查迅雷进程

2015-03-23 10:55

在极1S与极贰上面安装了迅雷远程下载,莫名每次重启路由均无法自启,设置START=99也不成,在start()下echo log证明是有执行命令的,没办法,只能使用crontab,先编辑 /etc/init.d/thunder

#!/bin/sh /etc/rc.common
# Copyright (C) 2007-2011 OpenWrt.org

START=98

start(){
pgrep -f "/tmp/storage/mmcblk0p2/thunder/lib/vod_httpserver" | if read PID;then exit;else /tmp/data/thunder/portal;fi
}
stop(){
/tmp/data/thunder/portal -s
}
restart(){
/tmp/data/thunder/portal
}
然后编辑/etc/crontabs/root文件,或者直接命令:crontab -e,在最后添加:

*/10 * * * * /etc/init.d/thunder start

每十分钟检查一下进程,如果没有运行,则启动迅雷远程。

来自另一条命令,如果进程存在则停止运行:

pgrep -f "/tmp/storage/mmcblk0p2/thunder/lib/vod_httpserver" | while read PID;do /etc/init.d/thunder stop;done

0 条回复

说两句