perl - Create scripts that run in different servers -
i have 3 servers used manage bunch of other client servers. 1 of managing servers has nagios, other has web proxy, has ldap , mysql server.
whenever need include new client server, have log server a, , create sql entry, go nagios , create entry, go web server , add proxy. picture. able have servers share scripts directory, '/opt/boxes/scripts` , in there have bunch of scripts know can run. i'm in server , run script x, should run on server b, run in server b.
is there simple way this? preferably perl bases since know little bit about.
one easy way may make directory each script on each of machines.
in 1 directory, actual script runs. in other directories, script ssh appropriate server , runs actual script.
e.g.
script add client ssh servera -c servera-addclient-to-sql ssh serverb -c serverb-addclient-to-nagios ssh serverc -c serverc-addclient-to-webproxy
adding scripts know run easy too.
in loose form
$runwhere = "xxxx" $scriptname = "yyyy" if `hostname` ne "xxxx" {ssh $runwhere -c $scriptname @args ; exit; } else { actual stuff }
so run anywhere, runs locally if thats right thing do, otherwise secure shell right place , runs same command there.
Comments
Post a Comment