Restore dns after tunnel down

This commit is contained in:
Eldwan Brianne
2021-03-14 11:56:50 +01:00
parent f0ec423f4d
commit e0f2cae85a
2 changed files with 10 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
TIMESTAMP_FORMAT='%a %b %d %T %Y' TIMESTAMP_FORMAT='%a %b %d %T %Y'
log() { log() {
echo "$(date +"${TIMESTAMP_FORMAT}") [tunnel-up] $*" echo "$(date +"${TIMESTAMP_FORMAT}") [tunnel-down] $*"
} }
# If deluge-pre-stop.sh exists, run it # If deluge-pre-stop.sh exists, run it
@@ -15,7 +15,7 @@ fi
echo "Sending kill signal to deluge-daemon" echo "Sending kill signal to deluge-daemon"
PID=$(pidof deluged) PID=$(pidof deluged)
kill $PID kill -9 $PID
# Give deluge-daemon time to shut down # Give deluge-daemon time to shut down
for i in {1..10}; do for i in {1..10}; do
ps -p $PID &> /dev/null || break ps -p $PID &> /dev/null || break

View File

@@ -1,3 +1,10 @@
#!/bin/bash #!/bin/bash
/etc/deluge/stop.sh if [ "${PEER_DNS}" != "no" ]; then
if [ -e /etc/resolv.conf-"${dev}".sv ] ; then
cp /etc/resolv.conf-"${dev}".sv /etc/resolv.conf
fi
chmod 644 /etc/resolv.conf
fi
/etc/deluge/stop.sh "$@"