0

I'm using in my script:

tar cfh - "$SRC_DIR" --exclude-from <(find $SRC_DIR -size +$EXCLUDE_MB_FILES) | pigz -9 --quiet --keep --recursive --rsyncable > $BACKUP_TARGER_DIR/$ARC_NAME | tee $LOG_FILE

But LOG_FILE is empty. Why?

Zanna
  • 70,465
Yura Shinkarev
  • 227
  • 1
  • 14

1 Answers1

0

Split command:

find -L $SRC_DIR -size +$EXCLUDE_MB_FILES > $EXCLUDE_LIST 2>> $LOG_FILE
RC=$?;
if [[ $RC != 0 ]]; then
    error find $RC
fi

tar cfh $TAR_FILE "$SRC_DIR" --exclude-from $EXCLUDE_LIST &>> $LOG_FILE
RC=$?;
if [[ $RC != 0 ]]; then
    error tar $RC
fi

pigz -9 --quiet --keep --recursive --rsyncable $TAR_FILE &>> $LOG_FILE
RC=$?;
if [[ $RC != 0 ]] || [ ! -f $GZ_FILE ]; then
    error pigz $RC
fi

mv $GZ_FILE $BACKUP_TARGER_DIR/$ARC_NAME
RC=$?;
if [[ $RC != 0 ]]; then
    error mv $RC
fi
Yura Shinkarev
  • 227
  • 1
  • 14
  • You could have done (tar cfh - "$SRC_DIR" --exclude-from <(find $SRC_DIR -size +$EXCLUDE_MB_FILES) | pigz -9 --quiet --keep --recursive --rsyncable > $BACKUP_TARGER_DIR/$ARC_NAME) 2>"$LOG_FILE" without splitting up – muru Sep 01 '17 at 12:47
  • Hm, I'm confused. I already try it. But get empty log file. Are you sure that your way redirect stderr of find and tar too? – Yura Shinkarev Sep 02 '17 at 05:29