14 lines
633 B
Bash
Executable File
14 lines
633 B
Bash
Executable File
#! /usr/bin/env bash
|
|
autorestic -c /etc/autorestic/.autorestic.yml --ci cron 1> /tmp/autorestic.log 2>/tmp/autorestic-err.log
|
|
ret=$?
|
|
|
|
if [[ "$ret" != 0 || -s /tmp/autorestic-err.log ]]
|
|
then
|
|
cat <(echo "Command failed with return code $ret and log:") /tmp/autorestic-err.log <(echo "===============") /tmp/autorestic.log | mail -s "Autorestic Backup: Failed" root
|
|
else
|
|
if [[ $(wc -l < /tmp/autorestic.log) -gt 15 ]]
|
|
then
|
|
cat <(echo -e "Command successfully finished with the following log:") /tmp/autorestic-err.log <(echo "===============") /tmp/autorestic.log | mail -s "Autorestic Backup: Success" root
|
|
fi
|
|
fi
|