Commit 9682f12b authored by Fjen Undso's avatar Fjen Undso
Browse files

style fixes

parent e3651d08
...@@ -10,7 +10,7 @@ source ./borgbackup.config.sh ...@@ -10,7 +10,7 @@ source ./borgbackup.config.sh
# borg backup # borg backup
info "Starting backup" info "Starting backup"
TMPFILE1="$(tempfile)" TMPFILE1="$(mktemp)"
borg create \ borg create \
--verbose \ --verbose \
--stats \ --stats \
...@@ -27,7 +27,7 @@ backup_exit=$? ...@@ -27,7 +27,7 @@ backup_exit=$?
# limit prune's operation to this machine's archives and not apply to # limit prune's operation to this machine's archives and not apply to
# other machine's archives also. # other machine's archives also.
info "Pruning repository" info "Pruning repository"
TMPFILE2="$(tempfile)" TMPFILE2="$(mktemp)"
borg prune \ borg prune \
--prefix '{hostname}-' \ --prefix '{hostname}-' \
--verbose \ --verbose \
...@@ -52,12 +52,14 @@ global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit )) ...@@ -52,12 +52,14 @@ global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit ))
if [ $global_exit != 0 ]; then if [ $global_exit != 0 ]; then
/usr/bin/logger -t backup "Exited abnormally with [$backup_exit][$prune_exit]" /usr/bin/logger -t backup "Exited abnormally with [$backup_exit][$prune_exit]"
MAIL="# borg create:\n" MAIL="# borg create:\n"
MAIL+="$(cat '$TMPFILE1')\n\n" MAIL+=$(cat "$TMPFILE1")
MAIL+="\n\n"
MAIL+="# borg prune:\n" MAIL+="# borg prune:\n"
MAIL+="$(cat '$TMPFILE2')\n\n" MAIL+=$(cat "$TMPFILE2")
MAIL+="\n\n"
MAIL+="# borg list:\n" MAIL+="# borg list:\n"
MAIL+="$(borg list)\n\n" MAIL+="$(borg list)\n\n"
MAIL+= "Cheers,\n$HOSTNAME" MAIL+="Cheers,\n$HOSTNAME"
echo -e "$MAIL" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "$HOSTNAME: borgbackup failed!" "$ADMINMAIL" echo -e "$MAIL" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "$HOSTNAME: borgbackup failed!" "$ADMINMAIL"
fi fi
rm -f "$TMPFILE1" "$TMPFILE2" rm -f "$TMPFILE1" "$TMPFILE2"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment