Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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';

Comment on Perlscript to sync two linux OSīs
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2014-09-23 04:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (210 votes), past polls