set up sshfs module and mounting with startup for 238/645/3115
parent
2d11a5d047
commit
a3fabcc7cd
|
@ -0,0 +1,3 @@
|
|||
/645.kebler.net/logs/
|
||||
/238.kebler.net/logs/
|
||||
*.log
|
|
@ -16,7 +16,6 @@ mnt238relays
|
|||
mnt238switches
|
||||
}
|
||||
|
||||
#!/bin/bash
|
||||
function ssh-unmount-238 () {
|
||||
echo mounting folders locally from 238 network hosts
|
||||
umnt238gate
|
|
@ -67,7 +67,7 @@ usmount /mnt/238/water/home
|
|||
}
|
||||
|
||||
function mnt238hass(){
|
||||
smount root@hassio.238.kebler.net:/ /mnt/238/hass -p 22
|
||||
smount root@hassio.238.kebler.net:/ /mnt/238/hass -p 22 -o allow_other
|
||||
}
|
||||
|
||||
function umnt238hass(){
|
|
@ -6,10 +6,14 @@ llog "sourcing: $f"
|
|||
source "$f"
|
||||
done
|
||||
# declare -F | grep 238
|
||||
delay=60
|
||||
mkdir -p $dir/logs
|
||||
touch $dir/logs/238-mount.log
|
||||
( sleep 60 ;
|
||||
notify-send "mounting 238 network directories in $delay secs"
|
||||
( sleep $delay ;
|
||||
echo $(date) > $dir/logs/238-mount.log;
|
||||
llog "after delay 238 network mounting"
|
||||
llog "after $delay sec delay 238 network is mounting"
|
||||
notify-send "mounting 238 network directories in /mnt/238"
|
||||
ssh-mount-238 2>&1 | tee -a $dir/logs/238-mount.log
|
||||
notify-send "done mounting 238 network directories"
|
||||
) &
|
|
@ -1,28 +0,0 @@
|
|||
Fri Nov 13 09:45:13 PST 2020
|
||||
mounting folders locally from 238 network hosts
|
||||
remote sysadmin@gateway.238.kebler.net:/home/sysadmin already mounted at /mnt/238/gate/sysadmin, aborting mount
|
||||
remote sysadmin@gateway.238.kebler.net:/opt already mounted at /mnt/238/gate/opt, aborting mount
|
||||
remote root@gateway.238.kebler.net:/ already mounted at /mnt/238/gate/root, aborting mount
|
||||
remote root@gateway.238.kebler.net:/etc already mounted at /mnt/238/gate/etc, aborting mount
|
||||
remote sysadmin@nas.238.kebler.net:/opt already mounted at /mnt/238/nas/opt, aborting mount
|
||||
remote sysadmin@nas.238.kebler.net:/mnt/data already mounted at /mnt/238/nas/data, aborting mount
|
||||
remote sysadmin@nas.238.kebler.net:/mnt/datamirror already mounted at /mnt/238/nas/datamirror, aborting mount
|
||||
remote sysadmin@nas.kebler.net:/home/sysadmin already mounted at /mnt/238/nas/sysadmin, aborting mount
|
||||
remote root@nas.238.kebler.net:/ already mounted at /mnt/238/nas/root, aborting mount
|
||||
remote root@hassio.238.kebler.net:/ already mounted at /mnt/238/hass, aborting mount
|
||||
remote sysadmin@trantor.kebler.net:/home/sysadmin already mounted at /mnt/238/trantor/sysadmin, aborting mount
|
||||
remote sysadmin@trantor.kebler.net:/opt already mounted at /mnt/238/trantor/opt, aborting mount
|
||||
remote sysadmin@trantor.kebler.net:/mnt/data already mounted at /mnt/238/trantor/data, aborting mount
|
||||
remote root@trantor.kebler.net:/ already mounted at /mnt/238/trantor/root, aborting mount
|
||||
remote sysadmin@water.kebler.net:/home/sysadmin already mounted at /mnt/238/water/home, aborting mount
|
||||
remote sysadmin@water.kebler.net:/opt already mounted at /mnt/238/water/opt, aborting mount
|
||||
remote root@water.kebler.net:/ already mounted at /mnt/238/water/root, aborting mount
|
||||
host lights.238.kebler.net not reachable, aborting mount
|
||||
host lights.238.kebler.net not reachable, aborting mount
|
||||
host lights.238.kebler.net not reachable, aborting mount
|
||||
host lights.238.kebler.net not reachable, aborting mount
|
||||
host lights.238.kebler.net not reachable, aborting mount
|
||||
host lights.238.kebler.net not reachable, aborting mount
|
||||
host lights.238.kebler.net not reachable, aborting mount
|
||||
host lights.238.kebler.net not reachable, aborting mount
|
||||
host lights.238.kebler.net not reachable, aborting mount
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
module_load sshfs
|
||||
module_load net-utils
|
||||
module_load filesystem
|
||||
|
||||
function ssh-mount-3115 () {
|
||||
echo ======== ...mounting 3115 devices via vpn ========
|
||||
mnt3115gate
|
||||
mnt3115nas
|
||||
mnt3115hass
|
||||
mntfrodo
|
||||
}
|
||||
|
||||
function ssh-unmount-3115 () {
|
||||
echo ======== ...mounting 3115 devices via vpn ========
|
||||
umnt3115gate
|
||||
umnt3115nas
|
||||
umnt3115hass
|
||||
umntfrodo
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/bash
|
||||
# vpn tunnel must be operation with dns resolution at 3115 dns server
|
||||
|
||||
|
||||
function mnt3115nas(){
|
||||
smount sysadmin@nas.3115.kebler.net:/opt /mnt/3115/nas/opt -p 22
|
||||
smount sysadmin@nas.3115.kebler.net:/mnt/data /mnt/3115/nas/data -p 22
|
||||
smount sysadmin@nas.3115.kebler.net:/mnt/backup /mnt/3115/nas/backup -p 22
|
||||
smount sysadmin@nas.3115.kebler.net:/home/sysadmin /mnt/3115/nas/sysadmin -p 22
|
||||
smount root@nas.3115.kebler.net:/ /mnt/3115/nas/root -p 22
|
||||
}
|
||||
|
||||
function umnt3115nas(){
|
||||
usmount /mnt/3115/nas/opt
|
||||
usmount /mnt/3115/nas/data
|
||||
usmount /mnt/3115/nas/backup
|
||||
usmount /mnt/3115/nas/sysadmin
|
||||
usmount /mnt/3115/nas/root
|
||||
}
|
||||
|
||||
function mnt3115gate(){
|
||||
smount root@grouter.3115.kebler.net:/ /mnt/3115/gate -p 22
|
||||
}
|
||||
|
||||
function umnt3115gate(){
|
||||
usmount /mnt/3115/gate
|
||||
}
|
||||
|
||||
|
||||
function mntfrodo(){
|
||||
smount sysadmin@frodo.kebler.net:/opt /mnt/3115/frodo/opt -p 22
|
||||
smount sysadmin@frodo.kebler.net:/home/sysadmin /mnt/3115/frodo/sysadmin -p 22
|
||||
smount sysadmin@frodo.kebler.net:/mnt/data /mnt/3115/frodo/data -p 22
|
||||
smount root@frodo.kebler.net:/ /mnt/3115/frodo/root -p 22
|
||||
}
|
||||
|
||||
function umntfrodo(){
|
||||
usmount /mnt/3115/frodo/opt
|
||||
usmount /mnt/3115/frodo/sysadmin
|
||||
usmount /mnt/3115/frodo/data
|
||||
usmount /mnt/3115/frodo/root
|
||||
}
|
||||
|
||||
function mnt3115hass(){
|
||||
smount root@hassio.3115.kebler.net:/ /mnt/3115/hass -p 22
|
||||
}
|
||||
|
||||
function umnt3115hass(){
|
||||
usmount /mnt/3115/hass
|
||||
}
|
||||
|
||||
# via NAT at WAN interface (mostly to support old gateway)
|
||||
|
||||
function mnt3115gatew(){
|
||||
smount sysadmin@3115.kebler.net:/opt /mnt/3115/wgate/opt -p 22
|
||||
smount sysadmin@3115.kebler.net:/home/sysadmin /mnt/3115/wgate/sysadmin -p 22
|
||||
smount root@3115.kebler.net:/ /mnt/3115/wgate/root -p 22
|
||||
}
|
||||
|
||||
function umnt3115gatew(){
|
||||
usmount /mnt/3115/wgate/opt
|
||||
usmount /mnt/3115/wgate/sysadmin
|
||||
usmount /mnt/3115/wgate/root
|
||||
}
|
||||
|
||||
function mnt3115nasw(){
|
||||
smount sysadmin@3115.kebler.net:/opt /mnt/3115/nas/opt -p 322
|
||||
smount sysadmin@3115.kebler.net:/mnt/data /mnt/3115/nas/data -p 322
|
||||
smount sysadmin@3115.kebler.net:/mnt/backup /mnt/3115/nas/backup -p 322
|
||||
smount sysadmin@3115.kebler.net:/home/sysadmin /mnt/3115/nas/sysadmin -p 322
|
||||
smount root@3115.kebler.net:/ /mnt/3115/nas/root -p 322
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
llog "startup for 3115 mounts"
|
||||
dir=$(dirname "$(dirname -- "${BASH_SOURCE[0]}")")
|
||||
for f in $dir/function/ssh-mounts/*; do
|
||||
llog "sourcing: $f"
|
||||
source "$f"
|
||||
done
|
||||
# declare -F | grep 238
|
||||
delay=60
|
||||
mkdir -p $dir/logs
|
||||
touch $dir/logs/3115-mount.log
|
||||
notify-send "mounting 3115 network directories in $delay secs"
|
||||
( sleep $delay ;
|
||||
echo $(date) > $dir/logs/3115-mount.log;
|
||||
llog "after $delay sec delay 3115 network is mounting"
|
||||
notify-send "mounting 3115 network directories in /mnt/3115"
|
||||
ssh-mount-3115 2>&1 | tee -a $dir/logs/3115-mount.log
|
||||
notify-send "done mounting 3115 network directories"
|
||||
) &
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
module_load sshfs
|
||||
module_load net-utils
|
||||
module_load filesystem
|
||||
|
||||
function ssh-mount-645 () {
|
||||
echo ======== ...mounting 645 devices via vpn ========
|
||||
mnt645gate
|
||||
mnt645nas
|
||||
mnt645hass
|
||||
mntnadal
|
||||
mnt645lights
|
||||
mnt645relays
|
||||
mnt645switches
|
||||
mnt645lightsbu
|
||||
}
|
||||
|
||||
function ssh-unmount-645 () {
|
||||
echo ======== ...mounting 645 devices via vpn ========
|
||||
umnt645gate
|
||||
umnt645nas
|
||||
umnt645hass
|
||||
umntnadal
|
||||
umnt645lights
|
||||
umnt645relays
|
||||
umnt645switches
|
||||
umnt645lightsbu
|
||||
}
|
|
@ -19,7 +19,7 @@ usmount /mnt/645/nas/root
|
|||
}
|
||||
|
||||
function mnt645gate(){
|
||||
smount root@grouter.645.kebler.net:/ /mnt/645/gate -p 22
|
||||
smount root@router.645.kebler.net:/ /mnt/645/gate -p 22
|
||||
}
|
||||
|
||||
function umnt645gate(){
|
||||
|
@ -28,10 +28,10 @@ usmount /mnt/645/gate
|
|||
|
||||
|
||||
function mntnadal(){
|
||||
smount sysadmin@nadal.kebler.net:/opt /mnt/645/nadal/opt -p 22
|
||||
smount sysadmin@nadal.kebler.net:/home/sysadmin /mnt/645/nadal/sysadmin -p 22
|
||||
smount sysadmin@nadal.kebler.net:/mnt/data /mnt/645/nadal/data -p 22
|
||||
smount root@nadal.kebler.net:/ /mnt/645/nadal/root -p 22
|
||||
smount sysadmin@nadal.645.kebler.net:/opt /mnt/645/nadal/opt -p 22
|
||||
smount sysadmin@nadal.645.kebler.net:/home/sysadmin /mnt/645/nadal/sysadmin -p 22
|
||||
smount sysadmin@nadal.645.kebler.net:/mnt/data /mnt/645/nadal/data -p 22
|
||||
smount root@nadal.645.kebler.net:/ /mnt/645/nadal/root -p 22
|
||||
}
|
||||
|
||||
function umntnadal(){
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/bash
|
||||
function mntw645lights(){
|
||||
smount sysadmin@testvpn.kebler.net:/home/sysadmin /mnt/645/lights/controller/sysadmin -p 322
|
||||
smount sysadmin@testvpn.kebler.net:/opt /mnt/645/lights/controller/opt -p 322
|
||||
smount root@testvpn.kebler.net:/ /mnt/645/lights/controller/root -p 322
|
||||
}
|
||||
# function mntw645lights(){
|
||||
# smount sysadmin@testvpn.kebler.net:/home/sysadmin /mnt/645/lights/controller/sysadmin -p 322
|
||||
# smount sysadmin@testvpn.kebler.net:/opt /mnt/645/lights/controller/opt -p 322
|
||||
# smount root@testvpn.kebler.net:/ /mnt/645/lights/controller/root -p 322
|
||||
# }
|
||||
|
||||
function mnt645lights(){
|
||||
smount sysadmin@controller.lights.645.kebler.net:/home/sysadmin /mnt/645/lights/controller/sysadmin -p 22
|
||||
|
@ -39,7 +39,7 @@ smount root@controller.lights.645.kebler.net:/ /mnt/645/lights/switches/root -p
|
|||
}
|
||||
|
||||
|
||||
function umntswitches(){
|
||||
function umnt645switches(){
|
||||
usmount /mnt/645/lights/switches/opt
|
||||
usmount /mnt/645/lights/switches/root
|
||||
usmount /mnt/645/lights/switches/sysadmin
|
|
@ -10,5 +10,3 @@ usmount /mnt/645/lights/backup/opt
|
|||
usmount /mnt/645/lights/backup/root
|
||||
usmount /mnt/645/lights/backup/sysadmin
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
llog "startup for 645 mounts"
|
||||
dir=$(dirname "$(dirname -- "${BASH_SOURCE[0]}")")
|
||||
for f in $dir/function/ssh-mounts/*; do
|
||||
llog "sourcing: $f"
|
||||
source "$f"
|
||||
done
|
||||
# declare -F | grep 238
|
||||
delay=60
|
||||
mkdir -p $dir/logs
|
||||
touch $dir/logs/645-mount.log
|
||||
notify-send "mounting 645 network directories in $delay secs"
|
||||
( sleep $delay ;
|
||||
echo $(date) > $dir/logs/645-mount.log;
|
||||
llog "after $delay sec delay 645 network is mounting"
|
||||
notify-send "mounting 645 network directories in /mnt/645"
|
||||
ssh-mount-645 2>&1 | tee -a $dir/logs/645-mount.log
|
||||
notify-send "done mounting 645 network directories"
|
||||
) &
|
|
@ -1,33 +0,0 @@
|
|||
#!/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
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
# depends on sshfs fuse for ssh
|
||||
module_load filesystem
|
||||
|
||||
function smount(){
|
||||
local HOST
|
||||
HOST=$(sed 's/.*@\(.*\):.*/\1/' <<< "$1")
|
||||
|
@ -7,13 +9,13 @@ HOST=$(sed 's/.*@\(.*\):.*/\1/' <<< "$1")
|
|||
if [[ $(mounted $2) ]]; then
|
||||
echo "remote $1 already mounted at $2, aborting mount"
|
||||
else
|
||||
echo "mounting $1 at $2 via ssh"
|
||||
sshfs $1 $2 $3 $4 -o default_permissions
|
||||
echo "mounting via ssh $*"
|
||||
sshfs "$@" -o default_permissions
|
||||
fi
|
||||
}
|
||||
|
||||
function usmount(){
|
||||
if [[ $(mountpoint $1 | grep not) ]]; then
|
||||
if [[ $(mounted $1) ]]; then
|
||||
echo "unmounting remote file system at $1"
|
||||
fusermount -u $1
|
||||
else
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
source "$BASH_SHELL_NETWORK/all/env/ssh-agent-socket.env"
|
||||
llog "ssh socket set to: $(env | grep SSH_AUTH_SOCK)"
|
Reference in New Issue