diff --git a/README.md b/README.md index 005d3ef..ccf7aec 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ After that, you will find the final backup archive in `/home/john/backup- sudo crontab -e -30 03 * * 6 EKEY=$(cat /home/john/.ekey) /usr/local/bin/backup.sh -b /usr/local/etc/sources.bk /home/john $EKEY +30 03 * * 6 EKEY=$(cat /home/john/.ekey) bash -c '/usr/local/bin/backup.sh -b /usr/local/etc/sources.bk /home/john $EKEY' > /dev/null 2>&1 ``` diff --git a/backup.sh b/backup.sh index 373125e..fdd6c6d 100755 --- a/backup.sh +++ b/backup.sh @@ -109,9 +109,10 @@ extract_backup() { BACKUP_SH_ARCHIVE_PATH="$1" BACKUP_SH_ARCHIVE_PW="$2" - openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 100000 -salt -d \ + (openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 100000 -salt -d \ -in "$BACKUP_SH_ARCHIVE_PATH" \ - -k "$BACKUP_SH_ARCHIVE_PW" | tar xvz + -k "$BACKUP_SH_ARCHIVE_PW" | tar xvz) > /dev/null 2>&1 \ + || (echo "Unable to extract backup." && exit 1) } helper() { diff --git a/backup.sh.1 b/backup.sh.1 index 8c72a90..b73d8ec 100644 --- a/backup.sh.1 +++ b/backup.sh.1 @@ -144,7 +144,7 @@ You can also use \f[B]backup.sh\f[R] from a crontab rule: .nf \f[C] $> sudo crontab -e -30 03 * * 6 EKEY=$(cat /home/john/.ekey) /usr/local/bin/backup.sh -b /usr/local/etc/sources.bk /home/john $EKEY +30 03 * * 6 EKEY=$(cat /home/john/.ekey) bash -c \[aq]/usr/local/bin/backup.sh -b /usr/local/etc/sources.bk /home/john $EKEY\[aq] > /dev/null 2>&1 \f[R] .fi .PP diff --git a/man.md b/man.md index e898fd2..eb0bf88 100644 --- a/man.md +++ b/man.md @@ -94,7 +94,7 @@ You can also use **backup.sh** from a crontab rule: ``` $> sudo crontab -e -30 03 * * 6 EKEY=$(cat /home/john/.ekey) /usr/local/bin/backup.sh -b /usr/local/etc/sources.bk /home/john $EKEY +30 03 * * 6 EKEY=$(cat /home/john/.ekey) bash -c '/usr/local/bin/backup.sh -b /usr/local/etc/sources.bk /home/john $EKEY' > /dev/null 2>&1 ``` This will automatically run **backup.sh** every Saturday morning at 03:30 AM.