First of all you should try to execute the script
online, then when you make sure it all went ok, just
put it in crontab...
Then..
You should create ssh--keys in order to connect without
any kind of interactivity from one server to the other.
Try with ssh-keygen and then ssh-copy_id, and then
modify the rsync command to something like that:
rsync -avvz --delete -e "ssh -i "/PATH/TO/KEY" -l USER"
--stats /home/copia/ 192.168.xxx.xx:/home/vrrp/dir/copia/
You should redirect the output of your script to a file, just
to check if it runs. Like that:
* * * * * /bin/scriptx.sh>>/path/to/rsync_output.log 2>&1
Hope it helps
bi
j
sinidr@libero.it wrote:
>Hi!I'm working with 2 linux, with 2 IP;I want make a copy of some files
inside one directory to the other linux.I called a file scriptx.sh in the first
linux and this is the body:
>#!/bin/bash
>rsync -avvz --delete --rsh=ssh --stats /home/copia/
root@192.168.xxx.xx:/home/vrrp/dir/copia/
>
>(xxx.xx are numbers...rights..only for security I crypted them)
>ok, then I create the crontab file with crontab -e and this is it:
>
>* * * * * /bin/scriptx.sh
>
>(every minute crontab should run...)
>But it doesn't run.....
>if I run this command from the line from the first linux is all ok,it
runs(it asks me the password,I enter it,and then is all ok)
>rsync -avvz --delete --rsh=ssh --stats /home/copia/
root@192.168.xxx.xx:/home/vrrp/dir/copia/
>
>where's the problem?why doesn't crontab work?
>1000000 thanks
>
>
>