aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Pedroni <e.pedroni91@gmail.com>2018-05-05 16:56:21 +0200
committerEduardo Pedroni <e.pedroni91@gmail.com>2018-05-05 16:56:21 +0200
commit33f3e8f2a154a8bf571e405b73636d82b9443eb0 (patch)
treec4092e511873b07c568cb5b7d59a88dc2973131f
parentcdfd119b1428277b20f033d1977ba64309cf6cb5 (diff)
Added backup lock to prevent stacked crashesHEADmaster
-rwxr-xr-xstromboli_backup15
1 files changed, 15 insertions, 0 deletions
diff --git a/stromboli_backup b/stromboli_backup
index ad5c74a..91bb763 100755
--- a/stromboli_backup
+++ b/stromboli_backup
@@ -1,5 +1,20 @@
#!/usr/bin/zsh
# Backup script for stromboli. This synchronises stromboli's local storage with the NFS data from vesuvio.
+BACKUP_LOCK="/tmp/backup_in_progress"
+
+# Do not attempt to backup if there is already a backup happening (it probably means something is wrong)
+if [[ -e "$BACKUP_LOCK" ]]; then
+ # TODO notify somehow (email?)
+ exit 1
+fi
+
+# Create backup lock file
+echo "Doing backup..." > "$BACKUP_LOCK"
+
+# Do backup
/home/eddy/bin/backup vesuvio: /home/eddy/backup
sync
+
+# Backup was successful, remove lock
+rm "$BACKUP_LOCK"