Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to share my problem with you. My boss wants that I will create 2 folders on two different servers. My first server is located at Germany and second one is in India. I have admins access on India Server and Remote access on German Server but Not admin access. Simple user access on German Server. My boss wants that When they put data on German Server folder which I create will automatically synchronize with Indian Server and we will receive all data in Indian file server. Where the another folder is located. He told me that I will create this job through cron jobs. Please suggest me how can I do this work?

I am using ubuntu file server on Indian Server. on I am using german server through Remote Desktop connection. I only use network drive there. I have only user permission there.

share|improve this question
The Indian server is Ubuntu. What about German server? Is it Windows, Linux, or.?? Also, you did not tell us about the available bandwidth you have between the two servers. More importantly, you did not specify the maximum allowed delay before the new/updated files should be copied. –  Khaled Jan 9 '13 at 7:32
Indian Server is Ubuntu. German Server is also Ubuntu. But as a shared drive. I am using German Remote Server and user shared network drive. the availability bandwidth is 45 mbps –  Anurag Vijaya Gautam Jan 9 '13 at 10:37
add comment

2 Answers

You can have a crontab running a rsync command

You could do that over an existing vpn connection, or over ssh, or a locally mounted directory. A good starting point in your case could be this document showing rsync over SSH and the crontabs and commands needed

rsync has the advantage that, after a (quite cpu intensive) analysis of what's on each side and what changed, it will then copy only what changed (ie, new files, or modified files, and in that case will only send the part of the file that changed!)

(with, or without, compression depending on the type of files : compress if most are text, don't compress if most are binaries or already compressed files)

But rsync needs some time to really know how it work: beware, for example, that depending on how you designate source and/or destination directories (ending, or not ending, their names with "/") the behaviour is VERY different. Sometimes you'll have to say "dir", sometimes "dir/", depending on how you wish the directory to be updated. I recommend you heavily test on dummy subdirectories (/tmp/a/safe/place, to the other host /tmp/another/safe/dir) (especially if you also use "--delete" which also deletes to make both match : don't add --delete until you're 100% sure what will be deleted and when)

Otherwise, if rsync can't be used on one of your servers, use whatever copying program is available (robocopy, etc). tar is quite often available on multiple platforms

share|improve this answer
Was about to type pretty much this. Rsync is your best bet. –  William Fleming Jan 9 '13 at 8:57
actually i have a question. when i typed crontab -e and press enter on Indian file server it is showing a crontab. where alredy many job are running. my question is can i put my new cron job in the end of the line or i need to create a new crontab. if i create my cron job after the last line. does it effect my other cron jobs? –  Anurag Vijaya Gautam Jan 9 '13 at 9:28
there is several crontabs: log in as the user that will need to run the command (not necessarily root) and then "crontab -e" will show you the crontabs for taht user. 1 line per command (on some systems, you'll need to end the last line with a Newline, or it won't be able to run that last line's commands). Add your crontab in last line or, if you prefer to sort them by usage, wherever appropriate –  Olivier Dulac Jan 9 '13 at 9:31
in addition to each user's crontab (usually stored in /var/spool/cron/..., but don't edit them there! use crontab -e instead) there is also usually a "global/system-wide" crontab in /etc/crontab (which you can edit manually) where you place commands for the system itself (log rotations, etc). It's maybe the one you're looking to edit –  Olivier Dulac Jan 9 '13 at 9:32
you need to find first how you'll do the comamnd itself. Once you egt it ok, you can transfert that command into a crontab. A crontab being just a way to launch a command (either a "one-liner", or a script invocation, at regular times). Please note that in a crontab, you may not have the same variable environment as it's launched by default via sh (which will just source /etc/profiles, iirc, and not your own login's .bashrc, for example). –  Olivier Dulac Jan 9 '13 at 10:49
show 1 more comment

You might want to try to mount the German server through SMB and then copy from there (with a cron job).

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.