Skip to content

Commit

Permalink
stab at fixing child proc wait issue
Browse files Browse the repository at this point in the history
  • Loading branch information
binhex committed Nov 13, 2023
1 parent a962302 commit 8117d7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions run/nobody/deluge.sh
@@ -1,5 +1,8 @@
#!/usr/bin/dumb-init /bin/bash

# source in script to wait for child processes to exit
source /usr/local/bin/waitproc.sh

# if config file doesnt exist (wont exist until user changes a setting) then copy default config file
if [[ ! -f /config/core.conf ]]; then

Expand All @@ -17,8 +20,8 @@ echo "[info] Attempting to start Deluge..."
echo "[info] Removing deluge pid file (if it exists)..."
rm -f /config/deluged.pid

# run deluge daemon (daemonized, non-blocking)
/usr/bin/deluged -c /config -L "${DELUGE_DAEMON_LOG_LEVEL}" -l /config/deluged.log
# run process non daemonised but backgrounded so we can control sigterm
nohup /usr/bin/deluged -d -c /config -L "${DELUGE_DAEMON_LOG_LEVEL}" -l /config/deluged.log &
echo "[info] Deluge process started"

echo "[info] Waiting for Deluge process to start listening on port 58846..."
Expand All @@ -34,6 +37,6 @@ echo "[info] Deluge process listening on port 58846"
if ! pgrep -x "deluge-web" > /dev/null; then
echo "[info] Starting Deluge Web UI..."

# run deluge-web (note this is blocking)
/usr/bin/deluge-web -c /config -L "${DELUGE_WEB_LOG_LEVEL}" -l /config/deluge-web.log
# run process non daemonised (blocking)
/usr/bin/deluge-web -d -c /config -L "${DELUGE_WEB_LOG_LEVEL}" -l /config/deluge-web.log
fi
2 changes: 1 addition & 1 deletion run/nobody/torrentcheck.sh
Expand Up @@ -6,7 +6,7 @@
# identify any torrents with state error and save these torrent id's as an array
torrent_id_error_array=( $(deluge-console -c /config "info -v" | grep -B 1 'State: Error' | xargs | grep -P -o -m 1 '(?<=ID:\s)[^\s]+' | xargs) )

if [[ -n ${torrent_id_error_array[@]} ]]; then
if [[ -n ${torrent_id_error_array[*]} ]]; then

echo "[warn] Torrents with state 'Error' found"

Expand Down

0 comments on commit 8117d7e

Please sign in to comment.