small bug fixes

This commit is contained in:
Shannon Sterz 2017-07-22 11:28:32 +02:00
parent fe37feb02e
commit f55408a258

10
backup.sh Normal file → Executable file
View file

@ -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