LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-05-2010, 10:09 AM   #1
meandsushil
Member
 
Registered: Feb 2010
Posts: 143

Rep: Reputation: 14
Question Ip-address in crontab


I want to set up a crontab so that from my machine {which is 192.168.0.99}
whatever I create in a directory called "/information" {suppose some texts files}will be copied to 192.168.0.100 and 192.168.0.101's machine "/readinfo" directory at 5.30 pm. everyday.

"/readinfo" is directory which is accessible by all users on that machines {192.168.0.100 & 192.168.0.101}

is this crontab right?

30 5 * * * /bin/cp -rf /information/* 192.168.0.100:/readinfo
30 5 * * * /bin/cp -rf /information/* 192.168.0.101:/readinfo

I guess first these 100 and 101 machines should allow me {99} ssh connection without passowrd.
What if this ssh connection setting is done then ?
 
Old 12-05-2010, 10:36 AM   #2
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
You'll want to use the command scp instead of cp since cp isn't aware of the network. What will happen with your crontab as is is that you'll copy all files in information to a directory called 192.168.0.100:/readinfo in whatever your corn's working directory is. scp copies files over an SSH connection and can be setup to not require a password with SSH keys. If you have any more questions just let us know.

Regards,

Alunduil
 
Old 12-05-2010, 10:42 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,604

Rep: Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960
Quote:
Originally Posted by meandsushil View Post
I want to set up a crontab so that from my machine {which is 192.168.0.99}
whatever I create in a directory called "/information" {suppose some texts files}will be copied to 192.168.0.100 and 192.168.0.101's machine "/readinfo" directory at 5.30 pm. everyday.

"/readinfo" is directory which is accessible by all users on that machines {192.168.0.100 & 192.168.0.101}

is this crontab right?
30 5 * * * /bin/cp -rf /information/* 192.168.0.100:/readinfo
30 5 * * * /bin/cp -rf /information/* 192.168.0.101:/readinfo

I guess first these 100 and 101 machines should allow me {99} ssh connection without passowrd. What if this ssh connection setting is done then ?
Crontab is right, but your commands are wrong. You can't do a regular copy to another machine...that would be SCP, which uses SSH. Unless the information directory is in your root, that path is wrong...same with the /readinfo destination. Also, you're not specifying a user, so by default, it's going to use root, which will probably fail. Anyone who is even halfway smart will always deny root access over the network.

The syntax for scp is well documented...most folks that have an RHCE and other certifications should know this.
 
Old 12-05-2010, 11:21 AM   #4
meandsushil
Member
 
Registered: Feb 2010
Posts: 143

Original Poster
Rep: Reputation: 14
Why do you talk about my RHCE again and again?
Don't get personal!
If you don't want to give me proper answer live it!
DON'T UNDERESTIMATE OTHERS!
 
Old 12-05-2010, 11:26 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
...more fundamentally:
What problem are you trying to overcome that "/readinfo" should be "accessible by all users on that machines"?
Why are you opting for "push" instead of "pull"? Push makes the server responsible while pull is the clients concern:
- With a small HTTP server like Thy and 'curl' on the client side you could let the client pull in files.
- With a Xinetd entry and 'rsync' you could do the same.
- The same goes for anonymous read-only FTP.
 
Old 12-05-2010, 12:47 PM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,604

Rep: Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960
Quote:
Originally Posted by meandsushil View Post
Why do you talk about my RHCE again and again?
Don't get personal!
If you don't want to give me proper answer live it!
DON'T UNDERESTIMATE OTHERS!
I gave you "proper answer", but you either didn't read it, or don't understand it.

Why mention your supposed RHCE? Because you keep asking very, VERY basic questions, that ANYONE who was awake for an RHCE course, could answer. Pay attention to the answers given to you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
linux crontab vs unix crontab ytd Linux - General 2 08-09-2009 05:07 AM
replaced crontab, now should get crontab back to what it was raminn Linux - Newbie 2 10-20-2008 07:15 PM
Crontab: How to change the default notification E-mail address? rignes Linux - Software 4 04-04-2007 02:21 PM
how to get ip address, broadcast address, mac address of a machine sumeshstar Programming 2 03-12-2005 04:33 AM
system-wide crontab in /etc/crontab ner Linux - General 2 11-18-2003 12:35 PM

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

All times are GMT -5. The time now is 03:36 AM.

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