From 9e82c96713989a7565eadac505b36e3dbe91cd5a Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sun, 11 Jun 2023 07:56:17 -0400 Subject: Added, removed, renamed scripts --- .local/bin/backups/assimilate | 60 ------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100755 .local/bin/backups/assimilate (limited to '.local/bin/backups') diff --git a/.local/bin/backups/assimilate b/.local/bin/backups/assimilate deleted file mode 100755 index fd6ed7f..0000000 --- a/.local/bin/backups/assimilate +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# Full system backup with borg - -# Validate argument - should either be onsite or offsite to specify location -ERRMSG="error: please specify either onsite or offsite" -[ $# -ne 1 ] && echo $ERRMSG && exit 1 -[ "$1" != "onsite" -a "$1" != "offsite" ] && echo $ERRMSG && exit 1 - -# Set variables -LOCATION="$1" -SUDO_OPTS="--preserve-env=BORG_PASSCOMMAND,PASSWORD_STORE_DIR" -CREATE_OPTS="--warning --stats --show-rc --exclude-caches --one-file-system" -LOG="$HOME/.config/borg/log" - -# Hack to get repository passphrase from pass -# The passcommand will be invoked as root, so use sudo to run it as the user calling the script -# who owns the password store. The environmental variable PASSWORD_STORE_DIR is passed through -# SUDO_OPTS to the borg commands, and then passed to this command from the borg command -# by the same means. This allows custom password store locations to work with this script. -export BORG_PASSCOMMAND="sudo $SUDO_OPTS -u $USER pass Borg-Backup/$(hostname)-$LOCATION" - -# Create variables and function to monitor exit status -WARNING=0 -ERROR=0 -check_rc() { - rc=$1 - [ $1 -eq 1 ] && WARNING=1 - [ $1 -eq 2 ] && ERROR=1 -} - -# Start backup -echo -e "\n$LOCATION $(date)\n" >> $LOG -notify-send "beginning $LOCATION backup" - -# Backup root partition -sudo $SUDO_OPTS borg create $CREATE_OPTS \ - --exclude '/dev/*' \ - --exclude '/proc/*' \ - --exclude '/sys/*' \ - --exclude '/tmp/*' \ - --exclude '/mnt/*' \ - --exclude '/media/*' \ - "/mnt/$LOCATION-backup/$(hostname)::root-{now:%Y-%m-%d}" / 2>>$LOG -check_rc $? - -# Backup boot parition -sudo $SUDO_OPTS borg create $CREATE_OPTS \ - "/mnt/$LOCATION-backup/$(hostname)::boot-{now:%Y-%m-%d}" /boot 2>>$LOG -check_rc $? - -# Send notifications based on return codes of archives - -[ $WARNING -eq 1 ] && notify-send "One or more archives produced a warning" \ - "Please check the log at $LOG" - -[ $ERROR -eq 1 ] && notify-send -u critical \ - "One or more archives produced an error and was unable to complete" \ - "Please check the log at $LOG" - -[ $WARNING -eq 0 -a $ERROR -eq 0 ] && notify-send "$LOCATION backup complete" -- cgit v1.2.3