From a013b6f6ab85c9771d27ad5e9d1e262f0baaa21b Mon Sep 17 00:00:00 2001 From: binhex Date: Thu, 2 May 2019 17:08:55 +0100 Subject: [PATCH] privoxy checks now in watchdog --- run/nobody/watchdog.sh | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/run/nobody/watchdog.sh b/run/nobody/watchdog.sh index 463f789..1e37225 100644 --- a/run/nobody/watchdog.sh +++ b/run/nobody/watchdog.sh @@ -5,6 +5,7 @@ while true; do # reset triggers to negative values sabnzbd_running="false" + privoxy_running="false" ip_change="false" if [[ "${VPN_ENABLED}" == "yes" ]]; then @@ -27,6 +28,22 @@ while true; do fi + if [[ "${ENABLE_PRIVOXY}" == "yes" ]]; then + + # check if privoxy is running, if not then skip shutdown of process + if ! pgrep -fa "privoxy" > /dev/null; then + + echo "[info] Privoxy not running" + + else + + # mark as privoxy as running + privoxy_running="true" + + fi + + fi + if [[ "${sabnzbd_running}" == "false" ]]; then # run script to start sabnzbd @@ -34,6 +51,18 @@ while true; do fi + if [[ "${ENABLE_PRIVOXY}" == "yes" ]]; then + + if [[ "${privoxy_running}" == "false" ]]; then + + # run script to start privoxy + source /home/nobody/privoxy.sh + + fi + + fi + + else echo "[warn] VPN IP not detected, VPN tunnel maybe down" @@ -52,6 +81,20 @@ while true; do fi + if [[ "${ENABLE_PRIVOXY}" == "yes" ]]; then + + # check if privoxy is running, if not then start via privoxy.sh + if ! pgrep -fa "privoxy" > /dev/null; then + + echo "[info] Privoxy not running" + + # run script to start privoxy + source /home/nobody/privoxy.sh + + fi + + fi + fi if [[ "${DEBUG}" == "true" && "${VPN_ENABLED}" == "yes" ]]; then