Skip to content
Snippets Groups Projects
Commit c2801f2d authored by nimrod's avatar nimrod
Browse files

Notify at the end of the backup.

parent 5df073e4
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ list_subvolumes() { ...@@ -6,6 +6,7 @@ list_subvolumes() {
} }
cleanup() { cleanup() {
exit_code="$?"
for volume in $(list_subvolumes "$source/.snapshot") for volume in $(list_subvolumes "$source/.snapshot")
do do
if [ -d "$source/.snapshot/$volume" ] if [ -d "$source/.snapshot/$volume" ]
...@@ -15,6 +16,12 @@ cleanup() { ...@@ -15,6 +16,12 @@ cleanup() {
done done
btrfs subvolume delete "$source/.snapshot" btrfs subvolume delete "$source/.snapshot"
sync --file-system "$source" sync --file-system "$source"
if [ "$exit_code" -eq 0 ]
then
curl "https://notify.shore.co.il/send?message=Backup%20finished%20successfully%20on%20$(hostname -s)."
else
curl "https://notify.shore.co.il/send?message=Backup%20failed%20on%20$(hostname -s)."
fi
} }
if [ "$#" -ne 2 ] if [ "$#" -ne 2 ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment