![]() |
Crontab does not run script?
Hi
I have got 2 NAS devices and I want to set up a nightly rsync backup from NAS1 to NAS2. On NAS1 I have the rsync script working fine if I start it from command line. (> /ffp/bin/snapshotMYBOOKWORLD.sh)No problems with ssh password etc. However, if I run the script via a crontab entry, I get rsync errors. What causes the script to fail?:confused: This is the rsync error I get 20110828_040508This is my crontab: root@DLINK:~# crontab -lThis is the backupscript root@DLINK:~# ls -l /ffp/bin/snapshotMYBOOKWORLD.shHope someone can help me!:) Regards Frank |
Do you use full paths in your script?
|
Not sure I use full paths ...
The funny thing is that the script runs fine when started from command line, but not when started via Crontab. This is the backupscript: # Set Source Path |
You could use the full path for the date command (for example /bin/date). You can find that out by running
Code:
which date |
Got it solved!
The cause was indeed the paths. I changed the rsync command into this and it works like a charm. $ffppath/bin/rsync -av -e /ffp/bin/ssh $srcpath $dstpath >> $ffppath/log/snapshotMYBOOKWORLD.log 2>&1 Thanks for the hint!:D |
By the way, one less important thing i cant explain....
The crontab - l shows this: root@DLINK:~# crontab -lAs you can see /ffp/bin/snapshot.sh is started twice ... how can this be? Crontab is configured using this script: #!/bin/sh |
Maybe the script was run twice. You can remove one of the two cronjobs by running
Code:
crontab -e |
Thanks,
crontab -e gives a kind of vi script which allows to delete one of the entries. Done deal! ;) So I've got an rsync backup solution up and runnning to a seperate device, which keeps my data super safe.:cool: |
| All times are GMT +2. The time now is 07:44. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.