Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Perlscript to sync two linux OSīs

by AlexTape (Monk)
on May 11, 2012 at 10:00 UTC ( #969960=perlquestion: print w/replies, xml ) Need Help??

AlexTape has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

probably my question is offtopic to perlmonks. however..

iīm meditating about comparing two linux vmīs {A,B} which are widely identic with a perl script {S}. even there is any mismatch in configuration or even filesystem issue (ONLY OS relevant files) the script should rewrite several parts of the system A in system B to get them identic. If D={any difference} the Algorithm should do this:
Bx{A,D}->S->B/D --> B=A
i suppose that a trivial comparison of each file is not the way to go. are there any modules which support this task or perhaps you got any ideas above comparing any config files?
one of the main characteristics is velocity...
donīt know if there is any solution in perl with good performance..?!

the idea behind this: every time i set up a new vm or even a user crashs e.g. server configurations on a vm i want to (r)sync(??) this vm with a still configured second vm lying down reachable in a network.

$perlig =~ s/pec/cep/g if 'errors expected';

Replies are listed 'Best First'.
Re: Perlscript to sync two linux OSīs
by Anonymous Monk on May 11, 2012 at 10:59 UTC
    So , something happens, and you call rsync to clobber existing files, and then you're finished? sounds good to me :)
Re: Perlscript to sync two linux OSīs
by pemungkah (Priest) on May 11, 2012 at 21:38 UTC
    I think Anon has a good point: you need to be really careful about this. There are a lot of things that might break very badly with this unless you can guarantee that
    • machine B is definitely down or at least in single-user mode before you start copying anything
    • that machine A has not gotten corrupted somehow, as you'll then break every machine in your setup
    • there are going to be a lot of unique-to-the-machine files that are going to be (and should be) out of sync
    You may be better off comparing the output from whatever system management you're using (dpkg, rpm, etc.) to a "standard setup" file on each machine; it can check itself and update as appropriate.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://969960]
Approved by Old_Gray_Bear
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2022-10-05 09:51 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (22 votes). Check out past polls.