群晖套件qb的守护脚本

由于群晖的qb套件进程自己莫名其妙就没了,写个脚本守护自动重启

cd /volume1/shell/ # 切换目录到 /

# 以下内容全部复制,粘贴执行
tee qb.sh <<-'EOF'
#!/bin/bash
#reboot qbittorrent service
while true
do
    qbittorrent=`ps -ef|grep "qbittorrent"|grep -v grep|wc -l`
    time=$(date "+%Y-%m-%d %H:%M:%S")

    if [ $qbittorrent -eq 0 ];then
    /volume1/@appstore/qBittorrent/bin/qbittorrent-nox -d --profile=/volume1/@appstore/qBittorrent --configuration=conf --webui-port=8585 & echo $time
    fi
    sleep 360
done

回到 DSM 网页,打开“控制面板”,选择“任务计划”,选择root权限,新增→“触发的任务”→“用户定义的脚本”→“事件”→“开机运行” 。

在“任务设置”的“用户自定义脚本”中填入:

nohup bash /volume1/shell/qb.sh &