So I have a script that does attempts to create a sql file on the server, and then zips that file up. I'm having an issue where the GZip call is being executed before the file is written. The odd thing is that when I run this on my VM instance it's totally fine. But when I test it on one of the servers, nothing but fail.
echo "Backing up $DB..."
$PROG_MYSQLDUMP -u $USERNAME -p${PASSWORD} -h $HOST $DB $IGNORES > ${DEST_FILE}
echo "Zipping file...${DEST_FILE}"
$PROG_GZIP $DEST_FILE
The only idea I have is to add a check before the GZip call is made that checks for the file and goes on only is it's there else after like X checks fails. I don't like this solution. Is there something I'm missing to get the script to wait on its own?
Thanks.
$PROG_GZIPwill not execute until$PROG_MYSQLDUMPhas exited, meaning the file has been written (or not).