AIX

DSH POWER

Sometimes we need to execute  a command on many aix systems at once, here comes the Distributed SHell utility .
DSH can rely on RSH or SSH to connect to clients and execute commands , obviously nowadays RSH is deprecated so the choice must be SSH.For example a customer requested me to change the timezone format from Posix to Olson for some application compatibility issues .

I wrote the node list in a text file called nodelist (yes i know , i have a lot of fantasy , LOL).
I created a command file called , mhh let’s try to guess…. cmdfile

#cat cmdfile.chgtz
cp /etc/environment /etc/environment.$(date +%Y-%m-%d_%T)
sed ‘s/^TZ.*$/TZ=NFT-1DFT,M3.5.0,M10.5.0/g’ /etc/environment > /etc/environment.new
grep TZ /etc/environment.new
mv /etc/environment.new /etc/environment
echo $TZ

and the shell script dsh_do.sh that do the stuff …reads the cmdfile and gives to it the nodelist as a parameter , one node at a time.

#cat dsh_do.sh

#!/usr/bin/ksh
while read node; do dsh -n $node -e ./cmdfile.chgtz; done < nodelist

Simply the command file makes a backup of the /etc/environment file , do the substitution with sed redirecting the output to a temp file . The temporary .new file is renamed to replace the original.
This solution give me the flexibility to do what i want (specified in cmdfile) on the nodes i want (in nodelist)
without visiting the clients.

2 pensieri su “DSH POWER

  1. If I might –perhaps you must take into account adding several images. I dont mean to disrespect what youve said; its quite enlightening, indeed. However, I believe would respond to it far more positively if they could be something tangible to your ideas. Maintain it up, but put a bit far more into it next time.

    1. Hi , you’re right … i had no time to make a nice or better work …these pages were intended just as a work notepad …anyway thanks for your comments , i think i’ve to make this blog more complete with contents and obviously images. Bye.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

This site uses Akismet to reduce spam. Learn how your comment data is processed.