backup

A simple system backup utility
git clone git://git.danielmoch.com/backup.git
Log | Files | Refs

commit c5386abd9a04b7c5d1bd072e5400cc474ddf92b1
parent 9fbb546d5ed554fa671fd2b553a35686d4461de7
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Wed, 20 Jun 2018 06:18:15 -0400

Fixes to backup script

Diffstat:
Mbackup | 22+++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/backup b/backup @@ -1,5 +1,5 @@ #!/bin/sh -[ -n "$BACKUP_OUTPUT" ] && exec 1> $BACKUP_OUTPUT 2>&1 +[ -n "$BACKUP_OUTPUT" ] && exec > $BACKUP_OUTPUT 2>&1 if [ $EUID -ne 0 ] then echo "`date`: Must be run as root" @@ -11,7 +11,7 @@ __cleanup() if [ -n "$BACKUP_MOUNTED" ] then umount $BACKUP_MOUNTPOINT - echo "Time Capsule unmounted" + echo "Backup location mounted" unset BACKUP_MOUNTED fi } @@ -45,14 +45,18 @@ then fi fi -if mount $BACKUP_MOUNTPOINT 2>&1 +if [ -n "$BACKUP_MOUNTPOINT" ] then - echo "Time Capsule successfully mounted" - BACKUP_MOUNTED=1 -else - echo "Time Capsule mount FAILED. Quitting." - echo "Ending backup: `date`" - exit -2 + if mount "$BACKUP_MOUNTPOINT" 2>&1 + then + echo "Backup location successfully mounted" + BACKUP_MOUNTED=1 + else + echo "Backup location mount FAILED. Confirm entry in /etc/fstab." + echo "Quitting." + echo "Ending backup: `date`" + exit -2 + fi fi BORG_PASSPHRASE=`cat $PASSFILE` borg create --stats \