Skip to content
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.

Executing script after tunnel up #108

Open
wants to merge 16 commits into
base: development
Choose a base branch
from
Open
3 changes: 2 additions & 1 deletion rootfs/etc/services.d/openvpn/run
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ exec s6-setuidgid "$(id -u openvpn):$(id -g openvpn)" openvpn \
--pull-filter ignore "dhcp-option DNS" \
--dhcp-option DNS "${DNS}" \
--redirect-gateway def1 bypass-dhcp \
--route "${LAN_FIRST_IP}" "${LAN_MASK}" net_gateway
--route "${LAN_FIRST_IP}" "${LAN_MASK}" net_gateway \
--script-security 2 --up-delay --up /usr/sbin/tunnelUp.sh --route-pre-down /usr/sbin/tunnelDown.sh
12 changes: 12 additions & 0 deletions rootfs/etc/services.d/qbittorrent/run
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,17 @@ else
echo "INFO: no port updater for provider ${OPENVPN_PROVIDER}"
fi

if [[ -v PRESTART ]]; then
if [[ -x $PRESTART ]]; then
echo "INFO: Executing $PRESTART..."
$PRESTART
echo "INFO: $PRESTART returned $?"
else
echo "WARNING: Variable PRESTART defined, but no executable file found at $PRESTART..."
fi
else
echo "INFO: PRESTART not defined."
fi

umask "${UMASK_SET:-002}"
exec s6-setuidgid "${PUID}:${PGID}" qbittorrent-nox
13 changes: 13 additions & 0 deletions rootfs/usr/sbin/tunnelDown.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

if [[ -v TUNNELDOWN ]]; then
if [[ -x $TUNNELDOWN ]]; then
echo "INFO: Executing $TUNNELDOWN..."
$TUNNELDOWN
echo "INFO: $TUNNELDOWN returned $?"
else
echo "WARNING: Variable TUNNELDOWN defined, but no executable file found at $TUNNELDOWN..."
fi
else
echo "INFO: TUNNELDOWN not defined."
fi
13 changes: 13 additions & 0 deletions rootfs/usr/sbin/tunnelUp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

jaype87 marked this conversation as resolved.
Show resolved Hide resolved
if [[ -v TUNNELUP ]]; then
if [[ -x $TUNNELUP ]]; then
echo "INFO: Executing $TUNNELUP..."
$TUNNELUP
echo "INFO: $TUNNELUP returned $?"
else
echo "WARNING: Variable TUNNELUP defined, but no executable file found at $TUNNELUP..."
fi
else
echo "INFO: TUNNELUP not defined."
fi