Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


copy particular folder from one backup vps to another with cron
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

copy particular folder from one backup vps to another with cron

rrrrrr Member

Hi

I am taking my backups from production server to a backup vps at Backupsy. I also baught another VPS for security with same provider.

I takes backup on Tuesday and on Friday. I want a cron script which will copy all data from first VPS to second VPS.

Can you tell me how can I achieve this?

Regards

Comments

  • set up ssh pubkey auth, then add to crontab:

    rsync -aAXv /your/source/dir -e ssh destinationuser@destinationserverip:/your/destination/dir --delete

  • @rrr said:
    Can you tell me how can I achieve this?

    Use rsync.

  • rrrrrr Member
    edited March 2014

    Can you explain me the code please.. also wht --delete will do? I think i should use this rsync in first VPS right? where backup is stored first time?

    How can I setup ssh pubkey via commmand line? I know how to via cPanel but not via SSH.

  • FritzFritz Veteran

    I'm using this to delete original source:

    rsync --remove-source-files -e -varuzP ssh destinationuser@destinationserverip:/your/destination/dir

  • Yes, setup public key, then rsync as mentioned above, or you can use scp (like: scp -P 22 /localserverdir root@destinationserverIP:/destinationdir) and then on destination server setup cronjob to delete old files from your backup dir (like: tmpwatch -m 720 /bckpdir) to delete things created/modiffied older than 30 days. (i can be wrong, its probable)

  • @rrr said:
    Can you explain me the code please.. also wht --delete will do? I think i should use this rsync in first VPS right? where backup is stored first time?

    How can I setup ssh pubkey via commmand line? I know how to via cPanel but not via SSH.

    http://linux.die.net/man/1/rsync

Sign In or Register to comment.