LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 06-13-2012, 07:29 AM   #1
eblonk
LQ Newbie
 
Registered: Dec 2009
Distribution: Kubuntu, Debian
Posts: 10

Rep: Reputation: 1
Running cron jobs centralized


Returning after a long time, now as a Linux network admin proper, I have a question on cron jobs.

The situation is that I need to synchronize user's home folder to to server. The basics are there and I can do it on my own machine by running a cron job doing rsync between /usr/local/home/<user> and /home/<user> (linking to server:/some-directory/<user>

The job works, so far so good.

However, I want to manage it centrally so that I don't have to go to every machine creating that job, not too mention that if I want to change to schedule, I have to go to every machine again.

What I'm looking for is a cron job that is managed from the server initiating cron jobs on workstations. It would look like
rsync /usr/local/home/$user /home/$user

There will be a period in which some users will still use their present home folders directly at the server and those who will have been set to local home folders with sync to server. There will be a file listing local folder users with their machines.

There will be a schedule that accounts for workstations being left on or turned off (some leaves theirs on for days or longer, other shut down) but I will consider that after I have set it up as a basic cron job.
 
Old 06-13-2012, 08:58 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
Well you can just write a cron script centrally that includes an ssh out to each server, or uses a different remote commadn execution mechanism like func, which I think is pretty ace.

I would suggest that the best way to do this is with Puppet, which will let you manage each systems cron job remotely based on all sorts of flexible and useful configurations. Puppet is wonderful, and cures global poverty and all known childhood diseases.
 
Old 06-14-2012, 07:21 AM   #3
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 11.4
Posts: 1,319

Rep: Reputation: 252Reputation: 252Reputation: 252
You could run rsync in damon mode all the time on the workstations (and limit access by password). Then you can just pull the data.
 
Old 06-15-2012, 07:51 AM   #4
eblonk
LQ Newbie
 
Registered: Dec 2009
Distribution: Kubuntu, Debian
Posts: 10

Original Poster
Rep: Reputation: 1
Maybe I got this right, could you have a look at this one:
rsync -a --delete PC01:/usr/local/home/john/ /export/home/john

As oppossed to the first example, I ran this from the commandline of the server. It did what I wanted it to do but it has 2 problems I have to solve:
- Warning: the RSA host key for 'PC01' differs from the key for the IP address '192.168.x.y'
Offending key for IP in /root/.ssh/known_hosts:a
Matching host key in /root/.ssh/known_hosts:b
(a, b, x and y are of course numbers)
Then it asks me to confirm
- root@PC01's password

What is the better approach: trying to solve this (it would make for a somewhat easy way to administer) or still go for a solution where the server remotely initiates rsync jobs?
[which would have this format: rsync -a --delete /usr/local/home/john/ /home/john - the job itself wouldn't go across machines, the mount on the PC takes care of that).

Another option I'm not sure of if it would work:
I create a private/public key pair on the server without a passphrase and export the public key to each workstation to prevent any request for confirmation or password.

I realize I throw a lot of options out, that is because I have scattered knowledge of each of the concepts. As it is I already tried to get to key pair solution to work, no success so far.
 
Old 06-15-2012, 07:57 AM   #5
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 11.4
Posts: 1,319

Rep: Reputation: 252Reputation: 252Reputation: 252
What you have in mind are two additonal ways: use ssh-keypair with out a passpharse (or with passphrase and a running ssh-agent) or by mounting all workstations directories on the server.

Running rsync in daemon mode what I suggested is third one. You can define arbitrary users/passwords (these can be random charcaters, as the user need not to exist on the machine, it’s only to access the daemon).
 
  


Reply

Tags
cron, linux


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
Cron jobs not running henrybg Linux - Enterprise 10 01-28-2013 10:23 AM
[SOLVED] Cron jobs not running saldon Linux - Server 2 01-08-2010 10:01 AM
One user's cron jobs not running dcroxton Linux - Software 5 03-06-2006 03:33 PM
shutdown only if no cron jobs are running Red Squirrel Linux - Software 4 08-31-2005 01:00 PM
cron jobs not running scarr3d Linux - Software 7 05-25-2004 04:21 PM


All times are GMT -5. The time now is 02:01 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration