34 lines
812 B
Bash
Executable File
34 lines
812 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# debug logging use -v for verbose i.e. logging
|
|
if [ "$1" = '-v' ]; then
|
|
# if not in live terminal session then log to file instead
|
|
tty -s;
|
|
if [ "0" != "$?" ]; then
|
|
SCRIPT_PATH=$(readlink -f "$0")
|
|
SCRIPT_DIR=$(dirname $SCRIPT_PATH)
|
|
SCRIPT_NAME=$(basename ${SCRIPT_PATH%.*})
|
|
mkdir -p $SCRIPT_DIR/logs
|
|
# log is the /logs subdirectory of original script directory
|
|
LOG_PATH="$SCRIPT_DIR/logs/$SCRIPT_NAME.log"
|
|
exec 1> $LOG_PATH 2>&1
|
|
fi
|
|
else
|
|
# silence stdout
|
|
exec 1> /dev/null
|
|
fi
|
|
|
|
echo $(date)
|
|
echo setting ssh-agent socket
|
|
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
|
|
echo source mounting functions
|
|
echo ======== ...mounting 645 devices via vpn ========
|
|
mnt645gate
|
|
mnt645nas
|
|
mnt645hass
|
|
mntnadal
|
|
mnt645lights
|
|
mnt645relays
|
|
mnt645switches
|
|
mnt645lightsbu
|