LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-10-2018, 07:42 AM   #1
Thar Htet Wai
LQ Newbie
 
Registered: Dec 2018
Posts: 4

Rep: Reputation: Disabled
transfer the directory from one server to another server with a cron job


Hi All,

I would like to request any idea about my problem. I would like to transfer the directory from one server to another server with time schedule such as cron job. My Distro is CentOS 7. Eg. I would like to transfer the directory from one server to another server at every 10 minute. Any idea? Really appreciate for yours kindly suggestions.Thank you.
 
Old 12-10-2018, 07:48 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
You can copy the directory with rsync or scp. You don’t say it, but I think you want the two directories synchronized. If so, raync is the better solution, as it only copies the files that are different.

You can do that every 10 minutes with cron.
 
1 members found this post helpful.
Old 12-10-2018, 07:51 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by Thar Htet Wai View Post
Hi All,
I would like to request any idea about my problem. I would like to transfer the directory from one server to another server with time schedule such as cron job. My Distro is CentOS 7. Eg. I would like to transfer the directory from one server to another server at every 10 minute. Any idea? Really appreciate for yours kindly suggestions.Thank you.
I would first suggest you read the "Question Guidelines" and "How to ask a smart question" links in my posting signature. A subject of "Help Me !!!" tells no one anything about your question. And there are many other threads you can find with a brief search that are almost identical to yours, that have solutions. And providing details about your environment helps too.

Using rsync could also easily be done, since that could also work over SSH, and that would probably be the first thing to investigate. Again, you don't provide details such as how much data, speed of the link between the systems, how much is going to change in those ten minutes, etc., etc....hard to give a good suggestion. But rsync is where I'd start.
 
1 members found this post helpful.
Old 12-10-2018, 07:52 AM   #4
Thar Htet Wai
LQ Newbie
 
Registered: Dec 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
You can copy the directory with rsync or scp. You don’t say it, but I think you want the two directories synchronized. If so, raync is the better solution, as it only copies the files that are different.

You can do that every 10 minutes with cron.

Thank you, I want to synchronized two directory. How about for Cron config? please could you show me the sample command? Appreciate for your kindly reply.
 
Old 12-10-2018, 08:02 AM   #5
Thar Htet Wai
LQ Newbie
 
Registered: Dec 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
I would first suggest you read the "Question Guidelines" and "How to ask a smart question" links in my posting signature. A subject of "Help Me !!!" tells no one anything about your question. And there are many other threads you can find with a brief search that are almost identical to yours, that have solutions. And providing details about your environment helps too.

Using rsync could also easily be done, since that could also work over SSH, and that would probably be the first thing to investigate. Again, you don't provide details such as how much data, speed of the link between the systems, how much is going to change in those ten minutes, etc., etc....hard to give a good suggestion. But rsync is where I'd start.
Hi Mr.TB0ne,

I have two server. 1st one server is existing server and 2nd server is the new installed.

1.I would like to transfer my 1st one server's directory such as /root/Server1_Data to my 2nd server's under /root Directory at every 10 minute.

2.Transfer Data size is 500 MB and speed of link between two server is 1Gbps.

3. There are two different network within the LAN.

Appreciate for your response.Thank you.
 
Old 12-10-2018, 08:12 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
if you wish to use rsync you could start with the man page, you could find an example inside.
Otherwise all what you need is available on the net as examples or tutorials, you can choose your preferred way.
(Here, at LQ we used to say we won't google it for you).
 
Old 12-10-2018, 08:22 AM   #7
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by Thar Htet Wai View Post
Thank you, I want to synchronized two directory. How about for Cron config? please could you show me the sample command? Appreciate for your kindly reply.
Your crontab should contain
Code:
* * * * 10  rsync ...
(or perhaps one more asterisk?)

Also, use man crontab. For rsync, you find numerous tutorials on the internet, including one by the auther, Andrew Tridgell.

EDIT: What I remember as Tridgell’s tutorial is actually the man page. Linuxjournal artcle about rsync: https://www.linuxjournal.com/article/6475.

Last edited by berndbausch; 12-10-2018 at 08:28 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian daily cron job won't run, but does run in cron.hourly. sandersch Linux - General 7 05-24-2012 01:50 AM
linux cron job duplicate job question cpthk Linux - Newbie 4 09-11-2009 08:52 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 01:50 PM
Can I make a Cron job to synch/transfer a file from a folder to another FTP?... read efishta Linux - General 6 07-19-2003 10:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration