From 07cdebca755d20bacd49dc6290f788adfa78b118 Mon Sep 17 00:00:00 2001 From: MarkusMcNugen Date: Sun, 4 Feb 2018 20:54:20 -0500 Subject: [PATCH] Update start.sh --- qbittorrent/start.sh | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/qbittorrent/start.sh b/qbittorrent/start.sh index eb749d9..7a40489 100644 --- a/qbittorrent/start.sh +++ b/qbittorrent/start.sh @@ -1,10 +1,8 @@ #!/bin/bash set -e -_handler() { - echo "[warn] Shutdown detected... cleaning up real quick!" | ts '%Y-%m-%d %H:%M:%.S' - # if config directory exists, apply permissions before exiting - chmod -R 755 /config/qBittorrent +handler() { + echo "[warn] Shutdown detected..." | ts '%Y-%m-%d %H:%M:%.S' } if [[ ! -e /config/qBittorrent ]]; then @@ -22,16 +20,13 @@ fi echo "[info] Starting qBittorrent daemon..." | ts '%Y-%m-%d %H:%M:%.S' /bin/bash /etc/qbittorrent/qbittorrent.init start & -echo "[info] Started qBittorrent daemon..." | ts '%Y-%m-%d %H:%M:%.S' chmod -R 755 /config/qBittorrent child=$(pgrep -o -x qbittorrent-nox) -echo "[info] qbittorrent-nox PID: $child" | ts '%Y-%m-%d %H:%M:%.S' +echo "[info] qBittorrent PID: $child" | ts '%Y-%m-%d %H:%M:%.S' -while true; do - if [ -e /proc/$child ]; then - sleep 0.1 - else - _handler - fi -done +if [ -e /proc/$child ]; then + sleep infinity +else + echo "qBittorrent failed to start!" +fi