LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   rsync mirroring with SSH (https://www.linuxquestions.org/questions/linux-networking-3/rsync-mirroring-with-ssh-441027/)

dlublink 05-02-2006 04:56 PM

rsync mirroring with SSH
 
All,

I have the command to do the sync:

rsync -avz --bwlimit=20 -e ssh --stats --progress /var/mail/virtual root@myhiddenhost.mydomain.net:/var/mail/

I would like to rsync automatically. I read about running a daemon, but it seems that running a daemon makes a new server and listens on a port. I would like the sync to happen automatically.

Am I best using a crontab? What's the best way to make sure that program doesn't run at the same time as itself?

Thanks,

David

centauricw 05-02-2006 10:07 PM

I am doing an automatic rsync each night between two Linux servers. The script runs from the crontab and connects using ssh. To be sure that you don't step on the running script, have it create a lockfile (usually I write the PID of the script to this file). At the beginning of the script, test for the existance of the lockfile and abort if it exists (meaning the script is already running).

dlublink 05-03-2006 08:18 AM

Quote:

Originally Posted by centauricw
I am doing an automatic rsync each night between two Linux servers. The script runs from the crontab and connects using ssh. To be sure that you don't step on the running script, have it create a lockfile (usually I write the PID of the script to this file). At the beginning of the script, test for the existance of the lockfile and abort if it exists (meaning the script is already running).

This is what I have setup, just seeing the words "rsync daemon" made me think their might be a better way to do it.

Turns out "rsync daemon" is for serving files on a network.

David


All times are GMT -5. The time now is 06:18 PM.