rsync not running in cron job; please help
I am trying to use rsync in a cron job but looks like cron is not running. Here is the setup:
Host = host.xxx.xxx Dest = dest.xxx.xxx The folder to copy from host is /home/mine and it should copy (rsync) to /home/mine in destination machine. Since I like to use ssh for this and didn’t want password question to pop up (because it should be in cron job), I followed instructions in the following instruction. • Generate a public key with ssh-keygen as the user that you will be connecting with rsync. Choose a good pass phrase. • Insert the key you just created into ~/.ssh/authorized_keys. • Copy the ~/.ssh/authorized_keys file to the other machine(s). • Set permissions (chmod 644) for ~/.ssh/authorized_keys, if needed. Then I tried manually the following command in host machine and it works. rsync -avz -e ssh /home/mine mine@dest.xxx.xxx:/home/mine Then in host (host.xxx.xxx) I did crontab –e and entered the following: 0 11 * * * rsync -avz -e ssh /home/mine mine@dest.xxx.xxx:/home/mine I was hoping that at 11 AM it would run, but it didn’t. What am I doing wrong? Could someone please help? -Ravi |
Since CRON uses a limited PATH, try to use the whole path to the commands and files.
Kind regards |
Quote:
-Ravi |
What account are you using to run the cron job? Is the job scheduled in the "mine" account crontab? What happens if you schedule it with the root account?
|
Any pointers in the log files?
Kind regards |
OK. I changed the command as follows to write the log file.
0 11 * * * rsync -avz -e ssh /home/mine mine@dest.xxx.xxx:/home/mine >>/tmp/rsyncA.log 2>&1 . The log file says the /home/mine is skipped. Why did it do that? I had just created a dummy file in /home/mine to verify that the files are copied to destination and I dont see it in the destination at all ! _Ravi |
Quote:
-Ravi |
Quote:
rsync: push_dir#3 "/root/mine@mine.xxx.xxx/home" failed: No such file or directory rsync error: errors selecting input/output files, dirs (code 3) at main.c(545) [receiver=2.6.8] rsync: connection unexpectedly closed (8 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(463) [sender=2.6.8] skipping directory /home/mine Help please! -Ravi |
Try running the cron job like this:
Code:
0 11 * * * rsync -avz -e ssh /home/mine mine@dest.xxx.xxx:/home/mine Quote:
|
All times are GMT -5. The time now is 03:38 PM. |