Jump to content


Photo

How To Synchronise Folders Automatically


  • Please log in to reply
1 reply to this topic

#1 silentz

silentz

    New To The Neighborhood

  • Members
  • Pip
  • 7 posts

Posted 29 June 2005 - 04:32 AM

I would love to see a tutorial on how to keep folders synchronised automatically (possibly using a chron job?). I have a testing server and a secure server folder that I'm repeatedly having to synchronise manually by going into file manager, copying folder A to a temp folder, deleting folder B, renaming folder A to folder B it in temp, and then copying folder B back to folder A's original directory... It gets pretty messy and repetitive doing this EVERY TIME I make a change to folder A when all I need is for folder B's to always mirror it's contents.

I'm sure that a tutorial on this would help just about anyone who has an SSL certificate with you guys and many people who just need their data backed up.

Cheers!


Piers

PS Knowing how to synch the contents barring a couple of files would be AWESOME! Thanks!

#2 TweezerMan

TweezerMan

    Immediate Family

  • Members
  • PipPipPipPip
  • 1,763 posts

Posted 01 July 2005 - 01:28 AM

I don't know that a full tutorial is required. I think the easiest way would be to use a 'cp' command in a cron job, configured with the "-a" archive option (don't follow symbolic links, preserve file attributes, and recurse subdirectories), and suppress any prompts that might appear:
cp -a --reply=yes /home/cpanelName/public_html/dirA /home/cpanelName/public_html/dirB

PS Knowing how to synch the contents barring a couple of files would be AWESOME!

<{POST_SNAPBACK}>

Excluding files means you aren't performing a true synchronization any more - it's more like a "selective copy". I think you'd need a CGI script to perform the copy from one directory to another - then the script could allow you to specify files not to be copied. The reason you'd need a CGI script (perl or PHP) is to preserve ownership of the copied files - files copied by a CGI script will be owned by "you" instead of "nobody". You'd then run the CGI script as a cron job instead of the 'cp' command I described above.

Hope this helps...
David Phillips (TweezerMan)
The Tweezer's Edge v3




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users