mirror of
https://github.com/haugene/docker-transmission-openvpn.git
synced 2025-08-31 19:31:13 +02:00
* DEBUG: print all lines before execution if var DEBUG is set to anything other than false, each bash script will be run with a set -x. This would ease debugging * DEBUG: centralize commands in utils.sh
39 lines
957 B
Bash
39 lines
957 B
Bash
#!/bin/bash
|
|
# redirect stdout/stderr to a file
|
|
source /etc/openvpn/utils.sh
|
|
|
|
#exec &>>route-pre-down.log
|
|
|
|
#Print Date
|
|
NOW=$(date +"%Y-%m-%d %T")
|
|
|
|
echo "${NOW}: route-pre-down script: Start "
|
|
|
|
echo "Sending exit signal to transmission."
|
|
TRANSMISSION_PASSWD_FILE=/config/transmission-credentials.txt
|
|
transmission_username=$(head -1 ${TRANSMISSION_PASSWD_FILE})
|
|
transmission_passwd=$(tail -1 ${TRANSMISSION_PASSWD_FILE})
|
|
transmission_settings_file=${TRANSMISSION_HOME}/settings.json
|
|
|
|
# Check if transmission remote is set up with authentication
|
|
auth_enabled=$(grep 'rpc-authentication-required\"' "$transmission_settings_file" \
|
|
| grep -oE 'true|false')
|
|
|
|
if [[ "true" = "$auth_enabled" ]]
|
|
then
|
|
echo "transmission auth required"
|
|
myauth="--auth $transmission_username:$transmission_passwd"
|
|
else
|
|
echo "transmission auth not required"
|
|
myauth=""
|
|
fi
|
|
|
|
transmission-remote $myauth --exit &
|
|
|
|
wait
|
|
|
|
echo "route-pre-down script: Done"
|
|
|
|
|
|
|