small bug fixes
This commit is contained in:
parent
fe37feb02e
commit
f55408a258
1 changed files with 5 additions and 5 deletions
10
backup.sh
Normal file → Executable file
10
backup.sh
Normal file → Executable 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
|
||||
|
||||
|
|
Loading…
Reference in a new issue