I have 3
nice commands that are dumping some databases, and compress assets for a backup. After that, the files should be copied to another server. I'm using this command:
nice mysqldump -u user1 -p'XXX' database1 | gzip > database1.sql.gz nice mysqldump -u user2 -p'XXX' database2 | gzip > database2.sql.gz nice zip -r assets.zip /var/www/site1/assets/ cd .. scp -R backups email@example.com:/home/user/backups
My problem is, that the
scp commands seems to get executed, BEFORE the nice commands are finished. This leads to partial SQL dumps, and sometimes broken zip files.
So how can I be sure, that all 3 nice commands are finished, before copying the files to another server?