Skip to content

Commit

Permalink
include socks support
Browse files Browse the repository at this point in the history
  • Loading branch information
binhex committed Jun 28, 2024
1 parent 6d615cb commit 3e646d1
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions run/nobody/watchdog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,44 @@ while true; do

fi

if [[ "${ENABLE_SOCKS}" == "yes" ]]; then

# get current bind ip for microsocks, if different to vpn_ip then kill
microsocks_current_bind_ip=$(pgrep -fa 'microsocks' | grep -o -P -m 1 '(?<=-b\s)[\d\.]+')

if [[ "${microsocks_current_bind_ip}" != "${vpn_ip}" ]]; then

echo "[info] Restarting microsocks due to change in vpn ip..."
pkill -SIGTERM "microsocks"

# run script to start microsocks
source /home/nobody/microsocks.sh

else

# check if microsocks is running, if not then skip shutdown of process
if ! pgrep -fa "/usr/local/bin/microsocks" > /dev/null; then

echo "[info] microsocks not running"

else

# mark microsocks as running
microsocks_running="true"

fi

if [[ "${microsocks_running}" == "false" ]]; then

# run script to start microsocks
source /home/nobody/microsocks.sh

fi

fi

fi

if [[ "${sabnzbd_running}" == "false" ]]; then

# run script to start sabnzbd
Expand Down Expand Up @@ -95,6 +133,20 @@ while true; do

fi

if [[ "${ENABLE_SOCKS}" == "yes" ]]; then

# check if microsocks is running, if not then start via microsocks.sh
if ! pgrep -fa "/usr/local/bin/microsocks" > /dev/null; then

echo "[info] microsocks not running"

# run script to start microsocks
source /home/nobody/microsocks.sh

fi

fi

fi

if [[ "${DEBUG}" == "true" && "${VPN_ENABLED}" == "yes" ]]; then
Expand Down

0 comments on commit 3e646d1

Please sign in to comment.