Dean Martin

Bash

Scripts

Starting point bash script:

#/usr/bin/env bash
set -euo pipefail
# -e strict, stop on error
# -u stop on undefined user variables
# -o stop on pipe | failures

Import environment variables from a file

export $(xargs < .env)

Resources

ssh tunnel:
ssh admin@10.36.8.43 -T -L 3631:localhost:631

Simple rsync starter:

#!/usr/bin/env bash
set -euo pipefail
FILES="
startbackup.sh
.ssh
hosts.txt
vimwiki
"
exclude="--exclude node_modules --exclude .git"
rsync $exclude --archive --partial --progress --human-readable --update --copy-links $FILES /mnt/backups/$(uname --nodename)/