thank you very much for taking the time to through some advice my way. Very much appreciated. I tried what you suggested, however the verbose mode is too much. What was important for this script was to record if the command succeeds or if it fails.
So I went around it with the following:
Code:
mysql -u $MYSQL_ROOT_USER -p$MYSQL_ROOT_PASS ${TEMP_DB} < $WORK_FILE_1
RESULT=$?
if [$RESULT -eq 0]
then
echo "...Done!" >> $LOG_FOLDER/${DATE_LOG}-movingDB.log
else
echo "...FAIL!" >> $LOG_FOLDER/${DATE_LOG}-movingDB.log
fi
This will at least record if the command worked or not.
HOWEVER, I find it hard to believe no one ever needed this before me. I mean if in the command
Code:
mysql -u $MYSQL_ROOT_USER -p$MYSQL_ROOT_PASS ${TEMP_DB} < $WORK_FILE_1 >> $LOG_FOLDER/${DATE_LOG}-movingDB.log 2>&1
I change the root user to some bogus one, then I get the logging I want. If I change the password to a bogus one I get the logging I want (the standard mysql error messages that would be displayed are redirected to the log file). But if I change something AFTER the < character (i.e. the path to the mysql dump that I want to import), then all I get is an error message onscreen and nothing in the log file. Could anyone explain why that is? (or point me in the right direction please?).
Thank you.