# Run the backup
/usr/bin/tar -cvf ${BACKUP_FILE} ${BACKUP_LOCATIONS} #scp ${BACKUP_FILE} m1008366@57.5.198.208:/backup/svn/fops << PPASS
/usr/bin/scp ${BACKUP_FILE} m1008366@57.6.198.206:/backup/svn/fops << PPASS
intel2707
PPASS
When i run this scrip manually it gives back up of size 2862295040 however if i crontab it it just results in the size 38881280. my crontab settings are
1 11 * * 1-6 . /scripts/backup-script.sh
Please help....
Regards..
RG
Yes Matrix... same versions of tar are being used...... Iam really confused how come the same script will work perfectly when we run manually...
Regarding SCP no issues i can do that, thanks for the tip...
Can u please dig more and report me
thanks again
Thanks vidyadhar ... Out of 200 directoried its is just able to tar 4 directories...it is stopping at folder by name trasaction with transactioid.txn files One more thing is that if i manually untar the 38 Mb back up i am getting an error
-rw-r--r-- www-data/root 61434 2009-01-29 19:07 repos/subversion/flightops/db/revs/2021
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
this will not come while untaring the 2.8GB tar file. It untars it without any issues...
Thanks..
For one thing, I would not use the `. /path/to/script` syntax. Put a first line in the script that says "#!/bin/ksh" or "#!/bin/bash" or whatever shell you use in your user environment. Then use `/path/to/script` as the syntax. That will at least ensure that your shell is the same in both user environment and cron.
You want to be looking for what might be different in the two environments.
For the moment, I assume we can ignore the scp, since you are not even getting the full tar file. Maybe comment out the scp and see what happens from cron.
Maybe add a line right after the tar line that does `echo "return code $?";`.
You don't get any output email from cron? (What it would do if an error message or other output was generated).
Thanks Choogendyk,
I placed #!/bin/bash, changed the `/path/to/script`, commented SCP and also i put in the return core it says " return code 2 "but no tar file has been created.. i dont know how to setup mail in Ubuntu... hep plz...
You're saying when you ran the script off cron, it gave a return code of 2, but you don't know how to setup mail . . . So, how did you get the output with the return code?
Anyway, 2 is a fatal error. But it doesn't really tell us much. Are there no other errors in the output? Or are you not yet getting an email of the output? If not, do as ripat suggests with MAILTO in your crontab.
I assume you are using the same user account interactively as with crontab?
Did you comment out all three lines of your scp?
You might try doing a `set` at the beginning of the script (right after the #! line), so that you can see what your environment is and what the differences are between interactive and cron.
If you can't resolve it playing around with these ideas, you might want to post a simplified version (leaving out the commented stuff) and the messages it produces. Don't bother with all the `set` output, just check it for differences.
Hi ALL,
I have resolved the issue by changing as below
cron settings to 01 11 * * 1-6 . /scripts/backup-script.sh > /scripts/rgklog3.txt
change is that " . / " and re-directing the o/p
then in the sctript #!/bin/sh and just tar no need of any /usr/bin .. nothing
and it started working and i followed another post on the same forum hot to exchange SCP public keys and that problem is also resolved...
Thank you very much all of u...
Regards,
Raghav
Cool. Enterprising of you to look through the forums and find the public key stuff. I was going to suggest that, but thought we should resolve the other stuff first.
I don't think you need the ". /" syntax. Redirecting the output to a file has gotten you around the email issue, and using sh instead of bash may have helped somehow.