If i have one server processing some feeds and creating a database. Then i want to copy the relevant tables from the first server to the second server. I have a shell script to do the copy. I was going to make a cron to run the script at a certain time. But it would not be ideal. I really want to somehow make absolutely sure that the first server has finished processing the feeds before the second server runs the DB import script. So rather than using a cron i wondered if there was a simple way to start the process from other server.
I guess i could use a password protected web page to achieve this. But i wondered if there was a nice way in unix?
You could always rcp a dummy file on second server when first has finished its processing...
And use cron for checking the presence of dummy (dont forget to remove it after...) and launch the import on the second server...
If you know its just a question of waiting, you could schedule at fixed time and in your cron script testing the presence of dummy, if not found reschedule using at command
.... because you have already set up and installed your public and private key pairs which were created without a password.
You can set this up the same way for SSH, BTW (that is if the keypairs you generated for rsync will not work for ssh, which I am not sure of without doing some research).
I am not sure if there is another way, but if when you use rsync, it is over SSH, probably, as commented by NEO, you already have keypairs setup, so you will not need to provide a password.
I tried this and it asked for a password i guess the key pairs are not set up for ssh. Does this mean my rsync uses rsh. How can i find this out? Here is what i put
echo "sh /home/scripts/test.sh" | ssh -C -l root 24.212.39.32
Pseudo-terminal will not be allocated because stdin is not a terminal.
Password:
I entered the root password and the script ran.
Should i set up the keypairs with ssh or should i supply the password in the ssh command if i can?