Format: date angepasst(restic/sanoid)

This commit is contained in:
Michael Grote 2021-01-10 16:10:24 +01:00
parent f4b794517e
commit 69acd7f536
2 changed files with 5 additions and 6 deletions

View file

@ -21,7 +21,7 @@ mount_return_value=$? # schreib Exit Code in Variable
if ( [ "$mount_return_value" -ne 0 ] ); then if ( [ "$mount_return_value" -ne 0 ] ); then
{ {
echo "--------------------------------------------------" # Trenner logfile echo "--------------------------------------------------" # Trenner logfile
echo $(date) # Datum für logfile echo $(date +%d.%m.%Y-%T) # Datum für logfile
echo "mount error" echo "mount error"
} >> /var/log/restic.log 2>&1; } >> /var/log/restic.log 2>&1;
tail --lines=5 "/var/log/restic.log" | mail -s "Backup-Error - restic - $HOSTNAME" {{ empfaenger_mail }} tail --lines=5 "/var/log/restic.log" | mail -s "Backup-Error - restic - $HOSTNAME" {{ empfaenger_mail }}
@ -29,7 +29,7 @@ if ( [ "$mount_return_value" -ne 0 ] ); then
else else
{ {
echo "--------------------------------------------------" # Trenner logfile echo "--------------------------------------------------" # Trenner logfile
echo $(date) # Datum für logfile echo $(date +%d.%m.%Y-%T) # Datum für logfile
echo "mount successful" echo "mount successful"
} >> /var/log/restic.log 2>&1; } >> /var/log/restic.log 2>&1;
fi fi
@ -40,7 +40,7 @@ while [[ "$abbruch_restic" -le {{ restic_anzahl_versuche_backup }} ]] # Schleife
do do
{ # ist keine Subshell sondern Grouping; https://askubuntu.com/questions/662190/write-the-output-of-multiple-sequential-commands-to-a-text-file { # ist keine Subshell sondern Grouping; https://askubuntu.com/questions/662190/write-the-output-of-multiple-sequential-commands-to-a-text-file
echo "--------------------------------------------------" # Trenner logfile echo "--------------------------------------------------" # Trenner logfile
echo $(date) # Datum für logfile echo $(date +%d.%m.%Y-%T) # Datum für logfile
restic -r {{ restic_mount }} --password-file /etc/restic/password.txt backup --exclude-file /etc/restic/exclude.txt {{ restic_folders_to_backup }} # execute Backup restic -r {{ restic_mount }} --password-file /etc/restic/password.txt backup --exclude-file /etc/restic/exclude.txt {{ restic_folders_to_backup }} # execute Backup
restic_return_value=$? # schreib Exit Code in Variable restic_return_value=$? # schreib Exit Code in Variable
if ( [[ "$restic_return_value" -eq 0 ]] ); # Prüfung ob restic erfolgreich war(setze Abbruchbedingung), wenn nicht warte 1min und zähle die Abbruchbedingung hoch if ( [[ "$restic_return_value" -eq 0 ]] ); # Prüfung ob restic erfolgreich war(setze Abbruchbedingung), wenn nicht warte 1min und zähle die Abbruchbedingung hoch

View file

@ -23,12 +23,11 @@ exlock
( (
echo "--------------------------------------------------" echo "--------------------------------------------------"
echo $(date) sanoid start echo $(date +%d.%m.%Y-%T) sanoid start
echo "" echo ""
/usr/local/bin/sanoid --cron --verbose /usr/local/bin/sanoid --cron --verbose
echo "" echo ""
echo $(date) sanoid end echo $(date +%d.%m.%Y-%T) sanoid end
echo "--------------------------------------------------"
) >> /var/log/sanoid-cron.log 2>&1 & ) >> /var/log/sanoid-cron.log 2>&1 &