From f55408a25840f48a46294e431cda1d3aac2c63cc Mon Sep 17 00:00:00 2001 From: Stefan Sterz Date: Sat, 22 Jul 2017 11:28:32 +0200 Subject: [PATCH] small bug fixes --- backup.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) mode change 100644 => 100755 backup.sh diff --git a/backup.sh b/backup.sh old mode 100644 new mode 100755 index bc38d1c..2331d5d --- a/backup.sh +++ b/backup.sh @@ -61,19 +61,19 @@ function backup () do if [ -n $"S" ] && [ -n "$TOSSH" ] && [ -z "$FROMSSH" ]; then $ECHO "$RSYNC -e \"$S\" -avR \"$SOURCE\" ${RSYNCCONF[@]} \"$TOSSH:$TARGET$1\" $INC " >> $LOG - $RSYNC -e "$S" -avR "$SOURCE" "${RSYNCCONF[@]}" "$TOSSH:\"$TARGET\"$1" $INC >> $LOG 2>&1 + $RSYNC -e "$S" -avR "$SOURCE" "${RSYNCCONF[@]}" "$TOSSH:\"$TARGET\"$1" $INC --exclude-from=$EXCLUDEFROM >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi elif [ -n $"S" ] && [ -z "$TOSSH" ] && [ -n "$FROMSSH" ]; then $ECHO "$RSYNC -e \"$S\" -avR \"$FROMSSH:$SOURCE\" ${RSYNCCONF[@]} $TARGET$1 $INC" >> $LOG - $RSYNC -e "$S" -avR "$FROMSSH:\"$SOURCE\"" "${RSYNCCONF[@]}" "$TARGET"$1 $INC >> $LOG 2>&1 + $RSYNC -e "$S" -avR "$FROMSSH:\"$SOURCE\"" "${RSYNCCONF[@]}" "$TARGET"$1 $INC --exclude-from=$EXCLUDEFROM >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi elif [-z "$S"] && [ -z "$TOSSH" ] && [ -z "$FROMSSh" ]; then $ECHO "$RSYNC -avR \"$SOURCE\" ${RSYNCCONF[@]} $TARGET$1 $INC" >> $LOG - $RSYNC -avR "$SOURCE" "${RSYNCCONF[@]}" "$TARGET"$1 $INC >> $LOG 2>&1 + $RSYNC -avR "$SOURCE" "${RSYNCCONF[@]}" "$TARGET"$1 $INC --exclude-from=$EXCLUDEFROM >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi @@ -98,7 +98,7 @@ function backup () $DATE >> $LOG if [ -n MAILADRESS ]; then - if [ -n $ERROR ]; then + if [ $ERROR ]; then $MAIL -s "[Backup] error occured during backup - $LOG" $MAILADRESS < $LOG else $MAIL -s "[Backup] backup created successfully - $LOG" $MAILADRESS < $LOG @@ -127,7 +127,7 @@ MONTH=$($DATE +%m) # %m = month as number HOUR=$($DATE +"%H") # %H = hour as number # Create a backup every first day in a month -if [[ $DAY = 1 ]]; then +if [[ $DAY = 01 ]]; then backup "monthly/$MONTH" fi