Update start.sh

This commit is contained in:
MarkusMcNugen 2018-02-04 20:54:20 -05:00 committed by GitHub
parent 7effb3cb97
commit 07cdebca75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,10 +1,8 @@
#!/bin/bash #!/bin/bash
set -e set -e
_handler() { handler() {
echo "[warn] Shutdown detected... cleaning up real quick!" | ts '%Y-%m-%d %H:%M:%.S' echo "[warn] Shutdown detected..." | ts '%Y-%m-%d %H:%M:%.S'
# if config directory exists, apply permissions before exiting
chmod -R 755 /config/qBittorrent
} }
if [[ ! -e /config/qBittorrent ]]; then if [[ ! -e /config/qBittorrent ]]; then
@ -22,16 +20,13 @@ fi
echo "[info] Starting qBittorrent daemon..." | ts '%Y-%m-%d %H:%M:%.S' echo "[info] Starting qBittorrent daemon..." | ts '%Y-%m-%d %H:%M:%.S'
/bin/bash /etc/qbittorrent/qbittorrent.init start & /bin/bash /etc/qbittorrent/qbittorrent.init start &
echo "[info] Started qBittorrent daemon..." | ts '%Y-%m-%d %H:%M:%.S'
chmod -R 755 /config/qBittorrent chmod -R 755 /config/qBittorrent
child=$(pgrep -o -x qbittorrent-nox) 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 if [ -e /proc/$child ]; then
sleep 0.1 sleep infinity
else else
_handler echo "qBittorrent failed to start!"
fi fi
done