This repository has been archived on 2022-02-20. You can view files and clone it, but cannot push or open issues/pull-requests.
bash-shell-network/645/misc/mount-645.sh

34 lines
812 B
Bash
Raw Normal View History

#!/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