mirror of
https://github.com/haugene/docker-transmission-openvpn.git
synced 2025-08-14 02:07:09 +02:00
* Add Transmissionic Web UI & New Documentation (#2589) * Added step to build a .deb file to install and reduce image size (#2590) * Added step to build a .deb file to install and reduce image size * Fixed deb install incorrectly done * Check for update-port script existing instead of being executable (#2593) #2459 * Fixed TWC paths (#2600) * add docker build caching to workflow (#2609) * Privoxy eth0 fixes, healthcheck comparison tweak and start.sh update (#2610) * by checking for existence of default 127 address,healthcheck will never effectively run, as the non-default eth0 ip will never be matched * the comparison was not trimming off the port, thus healthcheck was always going to fail or denote a change when there may have been none * simplified the comparison (thanks @edgd1er ) * Strip double quotes from umask check (#2601) * Fix problem with enabled UFW with Random Ports (#2603) Fixing #2255 * move vpn config download to /config (#2592) * move vpn config download to /config * fix git safe dir permissions * cleanup vpn config clone * re-add zip dl, set git to default * use alpine:latest for TransmissionUIs build stage (#2573) * Update fetch-external-configs.sh removed duplicate bracket * Update to transmission 4.0.4 * Update configure-openvpn.sh --------- Co-authored-by: Anastasiya Polina Soyka <apsoyka@protonmail.com> Co-authored-by: Geoff <geoff@gapple.ca> Co-authored-by: ksurl <ksurl@users.noreply.github.com> Co-authored-by: HeavyGee <133152184+heavygee@users.noreply.github.com> Co-authored-by: WitchRecipe <77073792+WitchRecipe@users.noreply.github.com> Co-authored-by: Florian Kretschmer <19738301+Entepotenz@users.noreply.github.com>
72 lines
1.8 KiB
Bash
Executable File
72 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
source /etc/openvpn/utils.sh
|
|
|
|
# Handle SIGTERM
|
|
sigterm() {
|
|
echo "Received SIGTERM, exiting..."
|
|
trap - SIGTERM
|
|
kill -- -$$
|
|
}
|
|
trap sigterm SIGTERM
|
|
|
|
#Network check
|
|
# Ping uses both exit codes 1 and 2. Exit code 2 cannot be used for docker health checks,
|
|
# therefore we use this script to catch error code 2
|
|
HOST=${HEALTH_CHECK_HOST}
|
|
|
|
if [[ -z "$HOST" ]]
|
|
then
|
|
echo "Host not set! Set env 'HEALTH_CHECK_HOST'. For now, using default google.com"
|
|
HOST="google.com"
|
|
fi
|
|
|
|
# Check DNS resolution works
|
|
nslookup $HOST > /dev/null
|
|
STATUS=$?
|
|
if [[ ${STATUS} -ne 0 ]]
|
|
then
|
|
echo "DNS resolution failed"
|
|
exit 1
|
|
fi
|
|
|
|
ping -c 2 -w 10 $HOST # Get at least 2 responses and timeout after 10 seconds
|
|
STATUS=$?
|
|
if [[ ${STATUS} -ne 0 ]]
|
|
then
|
|
echo "Network is down"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Network is up"
|
|
|
|
#Service check
|
|
#Expected output is 2 for both checks, 1 for process and 1 for grep
|
|
OPENVPN=$(pgrep openvpn | wc -l )
|
|
TRANSMISSION=$(pgrep transmission | wc -l)
|
|
PROXY=$(pgrep privoxy | wc -l)
|
|
|
|
if [[ ${OPENVPN} -ne 1 ]]; then
|
|
echo "Openvpn process not running"
|
|
exit 1
|
|
fi
|
|
if [[ ${TRANSMISSION} -ne 1 ]]; then
|
|
echo "transmission-daemon process not running"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ${WEBPROXY_ENABLED} =~ [yY][eE]?[Ss]?|[tT][Rr][Uu][eE] ]]; then
|
|
if [[ ${PROXY} -eq 0 ]]; then
|
|
echo "Privoxy warning: process was stopped, restarting."
|
|
fi
|
|
proxy_ip=$(grep -oP "(?<=^listen-address )[0-9\.]+" /etc/privoxy/config)
|
|
cont_ip=$(ip -j a show dev eth0 | jq -r .[].addr_info[].local)
|
|
if [[ ${proxy_ip} != ${cont_ip} ]]; then
|
|
echo "Privoxy error: container ip (${cont_ip} has changed: privoxy listening to ${proxy_ip}, restarting privoxy."
|
|
pkill privoxy || true
|
|
/opt/privoxy/start.sh
|
|
fi
|
|
fi
|
|
echo "Openvpn and transmission-daemon processes are running"
|
|
exit 0
|