diff options
-rwxr-xr-x | backup | 16 | ||||
-rwxr-xr-x | stromboli_backup | 15 |
2 files changed, 5 insertions, 26 deletions
@@ -1,6 +1,6 @@ #!/usr/bin/zsh -# rsyncs data from one directory to another. By default all subdirectories of the src directory are copied to the dst directory. Nothing happens unless both arguments are valid directories. +# rsyncs data from one directory to another. By default all subdirectories of the src directory are copied to the dst directory. No checks are done to verify that the arguments are directories because -d doesn't play nice with remote hosts. LOG_DIR="$HOME/rsync_logs" LOG_FILE="$LOG_DIR/$(date --iso-8601).log" @@ -12,16 +12,6 @@ if [ $# -lt 2 ]; then exit 1 fi -if [ ! -d "$1" ]; then - echo "$1 does not exist or is not a directory" - exit 1 -fi - -if [ ! -d "$2" ]; then - echo "$2 does not exist or is not a directory" - exit 1 -fi - if [ ! -d "$LOG_DIR" ]; then echo "Log directory does not exist, creating" mkdir -p "$LOG_DIR" @@ -38,8 +28,8 @@ if [ $? -ne 0 ]; then exit 1 fi -echo "rsync $RSYNC_OPTS ${1%/}/* $2" >> "$LOG_FILE" -rsync $RSYNC_OPTS ${1%/}/* $2 +echo "rsync $RSYNC_OPTS ${1%/}/ $2" >> "$LOG_FILE" +rsync $RSYNC_OPTS ${1%/}/ $2 if [ $? -eq 0 ]; then echo "Backup successful." >> "$LOG_FILE" diff --git a/stromboli_backup b/stromboli_backup index 190e7d3..ad5c74a 100755 --- a/stromboli_backup +++ b/stromboli_backup @@ -1,16 +1,5 @@ #!/usr/bin/zsh -# Backup script for stromboli. This synchronises stromboli's local storage with the NFS data from vesuvio. Since this script mounts and umounts the NFS, it should be configured to be mountable without root on fstab. - -mount /home/eddy/data - -if [ $? -ne 0 ]; then - # mount failed, better exit so that we don't wipe the existing backup - # TODO send some kind of failure notification - exit 1 -fi - -/home/eddy/bin/backup /home/eddy/data /home/eddy/backup +# Backup script for stromboli. This synchronises stromboli's local storage with the NFS data from vesuvio. +/home/eddy/bin/backup vesuvio: /home/eddy/backup sync - -umount /home/eddy/data |