#!/usr/bin/env bash # Backup the .bash_eternal_history file of select users. Files should all be # named in the format # # ${hostname}_${user}_bash_hist # Remote is being read out of ${remote_user}'s .ssh/config # Do not leave a password on the ssh key! Use a restricted user instead declare -r remote=mirrorside declare -r remote_user=emiliko declare -r backup_p='/home/emiliko/safe/bash_eternal_backups' declare -ar backups=(\ /home/emiliko/.bash_eternal_history "${backup_p}/waybook_emiliko_bash_hist" /root/.bash_eternal_history "${backup_p}/waybook_root_bash_hist" ) # Check for internet if ! curl -m 3 archlinux.org &>/dev/null; then echo "Failed to connect to archlinux.org in 3 seconds. No backup was made" >&2 exit 1 fi # Make the directory sudo -u "$remote_user" bash <