many things

This commit is contained in:
Christoph J. Scherr 2023-10-31 19:52:30 +01:00
parent e867840385
commit e18752f758
4 changed files with 33 additions and 2 deletions

View File

@ -4,7 +4,7 @@
export BORG_REPO=/srv/data/backup/borg/homeserver export BORG_REPO=/srv/data/backup/borg/homeserver
# See the section "Passphrase notes" for more infos. # See the section "Passphrase notes" for more infos.
export BORG_PASSPHRASE="$(cat /root/secret/borg-homeserver.key)" export BORG_PASSPHRASE="$(cat /root/secret/borg/borg-homeserver.key)"
# some helpers and error handling: # some helpers and error handling:
info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; } info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; }

View File

@ -19,7 +19,8 @@ borg check -v data/backup/borg/snowboard
status_check=$? status_check=$?
echo "finished checking the downloaded repo. Status: $status_check" echo "finished checking the downloaded repo. Status: $status_check"
if [ "$status_check" -eq "0" ]; then if [ "$status_check" -eq "0" ]; then
chown fileserver:fileserver $REPO_DIR/$backupdir cd $REPO_ROOT
chown fileserver:fileserver $backupdir
rm -r old rm -r old
else else
echo "the new repo was not checked successfully, keeping old repo." echo "the new repo was not checked successfully, keeping old repo."

25
mount-docker-sockets.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
TARGET=/var/run/docker-snowboard.socket
MAX_FAILS=10
SLEEP_TIME=2
echo "removing $TARGET"
rm /var/run/docker-snowboard.sock -rf
echo "relaying snowboards socket with ssh"
ssh -nNT -L /var/run/docker-snowboard.sock:/var/run/docker.sock root@cscherr.de &
# check if the target is a socket, and adjust it.
for ((i=0; i<=MAX_FAILS; i++)); do
if [[ $(file -b /var/run/docker-snowboard.sock) = 'socket' ]]; then
set -e
echo "$TARGET is a socket, adjusting permissions"
chmod 660 /var/run/docker-snowboard.sock
chgrp docker /var/run/docker-snowboard.sock
exit 0 # good end
else
echo "$i: $TARGET is not a socket"
fi
sleep $SLEEP_TIME
done
echo "$TARGET is not a socket even after waiting"
exit 1 # bad end

5
tailscale.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
tailscale up \
--login-server https://vpn.cscherr.de \
--advertise-exit-node \
--accept-risk=lose-ssh