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.
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.
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.
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.
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).
|All times are GMT -5. The time now is 05:25 AM.|