Crontab not executing specific script
I am running to a weird issue: for some reason when I try to run a crontab script which has these two operations:
mysqldump -v --opt --password=65eCom6 udb | bzip2 -9 > /home/backups/udb_mysql_$DATE.sql.bz2
smbclient \\\\vulcan35\\e -A=/root/.smb-credentials \
-c "cd Database_backup; lcd /home/backups; put udb_mysql_$DATE.sql.bz2; exit"
this script only do the sql backup but dont put it in the folder.
but when I reduce this script to the first sql backup only and I use another cron job to put this dump file to the folder it goes through...weird isn't it?
so 1+2 in 1 cronjob don't work but 1 in 1 cronjob and 2 in another cronjob it works perfect. any thoughts?
A first guess:
The second command is executed before the first one has finished.
Solution to that: put "&&" at the end of first command.
"mysqldump -v --opt --password=65eCom6 udb | bzip2 -9 > /home/backups/udb_mysql_$DATE.sql.bz2 &&"
Thanks! yup it was my guess also, i'll try and get back to you.
Thanks Pingu! the issue is just solved with the two magic "&&"
|All times are GMT -5. The time now is 03:57 AM.|