I am working on a set of scripts that will update a second/backup server when a user, group or ibay is created or a password modified on the main server.
Below is an example of the remote-create-user script.
It is called by the signal-event create-user on the main server when a user is created.
I am using unison for synchronisation. I have created a RSA key pair between the two servers so I dont get asked for the password every time.
#!/usr/bin/perl -w
my $user = $ARGV [1];
system ("/usr/local/sbin/unison", "/home/e-smith/accounts", "ssh://192.168.2.4//home/e-smith/accounts", "-batch", "-silent", "
-force", "/home/e-smith/accounts");
system ("/usr/bin/ssh", "192.168.2.4", "/sbin/e-smith/signal-event", "user-create", $user);
I have created scripts for remote-user-create, remote-user-modify, remote-user-delete, remote-group-add, remote-group-modify, remote-group-delete, remote-ibay-create, remote-ibay-modify, remote-ibay-delete and remote-password modify.
The machine that you are updating can either be local or at a remote site.
I need to tidy the scripts up a bit and add few more for creating, modifying and deleting virtual domains. I want to add a remote-host property to the configuration database that is updated via a page on the server-manager and use a variable $remoteHost in the scripts. I will then package it up as a rpm.
Jon