Improved cron/forget scripts

This commit is contained in:
2023-03-17 00:01:01 +00:00
parent b839038784
commit b9bbbe7d55
2 changed files with 8 additions and 8 deletions

View File

@@ -2,9 +2,9 @@
autorestic -c /etc/autorestic/.autorestic.yml --ci forget --all --prune 1> /tmp/autorestic-prune.log 2>/tmp/autorestic-prune-err.log
ret=$?
if [ "$ret" != 0 ] || [ -s /tmp/autorestic-prune-err.log ]
if [[ "$ret" != 0 || -s /tmp/autorestic-prune-err.log ]]
then
cat <(echo -e "Command failed with return code $ret and log:") /tmp/autorestic-prune-err.log | mail -s "Autorestic Pruning: Failed" root
cat <(echo "Command failed with return code $ret and log:") /tmp/autorestic-prune-err.log <(echo "===============") /tmp/autorestic-prune.log | mail -s "Autorestic Pruning: Failed" root
else
cat <(echo -e "Command successfully finished with the following log:") /tmp/autorestic-prune.log | mail -s "Autorestic Pruning: Success" root
cat <(echo "Command successfully finished with the following log:") /tmp/autorestic-prune.log | mail -s "Autorestic Pruning: Success" root
fi