- openwrt 没有 systemd
- 编写了一个 shell 脚本 配合 crond 服务一直没有成功
#!/bin/sh
while true
do
COUNT=$(ps |grep qbittorrent |grep -v grep |wc -l)
echo "current running qbittorrent process count: "$COUNT
if [ $COUNT -eq 0 ]
then
su - transmission <<EOF
/usr/bin/qbittorrent-nox --profile=/mnt/ThreeTB2/qbit_backup
echo "qbittorrent-nox process has been restarted!"
EOF
else
echo "qbittorrent-nox already started!"
fi
sleep 10
done
kill $!
以上文件放在 /mnt/ThreeTB2/qbittorrent.sh 已经添加 可执行权限
cron 脚本是 */3 * * * * /bin/ash /mnt/ThreeTB2/qbittorrent.sh > /tmp/crontab-qbittorrent-sh.log
测试的时候 用的 每隔三分钟 执行一次
但是调试了一段时间 发现并不靠谱…… 希望大神前来指点