aboutsummaryrefslogtreecommitdiffstats
path: root/backup
diff options
context:
space:
mode:
authorEduardo Pedroni <e.pedroni91@gmail.com>2018-04-14 15:22:47 +0200
committerEduardo Pedroni <e.pedroni91@gmail.com>2018-04-14 15:22:47 +0200
commitcdfd119b1428277b20f033d1977ba64309cf6cb5 (patch)
tree2ef27a4e0cdc196bf7547a24c110d118c5ada2e1 /backup
parent1d5d8961615ff385bbf9147fd5f6ecd71b7b119d (diff)
Adapted backup system to use rsync over SSH instead of the NFS mount
Diffstat (limited to 'backup')
-rwxr-xr-xbackup16
1 files changed, 3 insertions, 13 deletions
diff --git a/backup b/backup
index 9b71686..4097a93 100755
--- a/backup
+++ b/backup
@@ -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"