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 do
if [ -n $"S" ] && [ -n "$TOSSH" ] && [ -z "$FROMSSH" ]; then if [ -n $"S" ] && [ -n "$TOSSH" ] && [ -z "$FROMSSH" ]; then
$ECHO "$RSYNC -e \"$S\" -avR \"$SOURCE\" ${RSYNCCONF[@]} \"$TOSSH:$TARGET$1\" $INC " >> $LOG $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 if [ $? -ne 0 ]; then
ERROR=1 ERROR=1
fi fi
elif [ -n $"S" ] && [ -z "$TOSSH" ] && [ -n "$FROMSSH" ]; then elif [ -n $"S" ] && [ -z "$TOSSH" ] && [ -n "$FROMSSH" ]; then
$ECHO "$RSYNC -e \"$S\" -avR \"$FROMSSH:$SOURCE\" ${RSYNCCONF[@]} $TARGET$1 $INC" >> $LOG $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 if [ $? -ne 0 ]; then
ERROR=1 ERROR=1
fi fi
elif [-z "$S"] && [ -z "$TOSSH" ] && [ -z "$FROMSSh" ]; then elif [-z "$S"] && [ -z "$TOSSH" ] && [ -z "$FROMSSh" ]; then
$ECHO "$RSYNC -avR \"$SOURCE\" ${RSYNCCONF[@]} $TARGET$1 $INC" >> $LOG $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 if [ $? -ne 0 ]; then
ERROR=1 ERROR=1
fi fi
@ -98,7 +98,7 @@ function backup ()
$DATE >> $LOG $DATE >> $LOG
if [ -n MAILADRESS ]; then if [ -n MAILADRESS ]; then
if [ -n $ERROR ]; then if [ $ERROR ]; then
$MAIL -s "[Backup] error occured during backup - $LOG" $MAILADRESS < $LOG $MAIL -s "[Backup] error occured during backup - $LOG" $MAILADRESS < $LOG
else else
$MAIL -s "[Backup] backup created successfully - $LOG" $MAILADRESS < $LOG $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 HOUR=$($DATE +"%H") # %H = hour as number
# Create a backup every first day in a month # Create a backup every first day in a month
if [[ $DAY = 1 ]]; then if [[ $DAY = 01 ]]; then
backup "monthly/$MONTH" backup "monthly/$MONTH"
fi fi