KEMBAR78
Aix Script 1 PDF | PDF | Secure Shell | Command Line Interface
0% found this document useful (0 votes)
64 views5 pages

Aix Script 1 PDF

aix script
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views5 pages

Aix Script 1 PDF

aix script
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

AIXchange: Another Great AIX Script Page 1 of 5

• AIX
• IBM i
• MAINFRAME
• POWER

• Video
• Buyers Guide
• Newsletters
• About Us

• Subscribe
• Current Issue
• Archive
• App

« Making the Case for AIX and Power Systems | Main | Can
You Restore? Now's the Time to Find Out »

May 13, 2008

Another Great AIX Script


Rob
I recently saw another great script from the mailing list, written
McNelly
by Dean Roswell. To get it working on my machine, I loaded
these rpms from the AIX Toolbox CD:

tcl-8.4.7-3.aix5.1.ppc.rpm
tk-8.4.7-3.aix5.1.ppc.rpm
expect-5.42.1-3.aix5.1.ppc.rpm

Recent Comments Then I followed the instructions in the script's introductory


comments (seen in the script listed below) and set up the ssh
Julie Craft on A Look at IBM keys to allow automatic login from my AIX machine to my VIO
server. After editing the list of VIO servers in the script to match Links
Electronic Support
what I had in my environment, I was able to use this script to
rootvg.net
Rob on Dual HMCs and Interface send out the same command to multiple VIO servers at the
poweraix.org
Locking same time.
tomfarwellconsulting
John Bogoslofski on Dual HMCs They gave some examples from the e-mail I saw. blackboxperf.com
and Interface Locking
Syntax:
Anthony English on Advice on HMC
Connections root@coenim:/:# dshvio -?
Valid parameters are:
steve button on BYOD's Slippery -r for a root command
Slope -n for a list of VIO servers
-n vios1
Rob on Power Systems Experts -n vios1,vios2
Weigh In
A regular VIOS command:
sandeep on Power Systems
Experts Weigh In root@coenim:/:# dshvio ioslevel
=========================
Anthony English on UNIX Has 2 VIO server --> coevios1
Vowels... and That's About It =========================
Anthony English on UNIX Has 2
1.5.1.1-FP-10.1
Vowels... and That's About It
=========================
VIO server --> coevios2
Dean Rowswell on Getting NPIV =========================
Info from VIO Servers 1.5.1.1-FP-10.1 Categories
An example of running a command through oem_setup_env
4G
automatically:
Recent Posts
AIX
dshvio -r fget_config -Av
Restricting FTP Access ========================= AIX 5.3
A Look at IBM Electronic Support
VIO server --> coevios1
========================= AIX Dynamic System Optimizer

http://ibmsystemsmag.blogs.com/aixchange/2008/05/another-great-a.html 9/27/2013
AIXchange: Another Great AIX Script Page 2 of 5

Advice on HMC Connections ---dar0--- AIX Virtual User Group

AIX, NIM Make System Restoration User array name = 'COE-DS4700' Announcements
Easier dac0 ACTIVE dac1 ACTIVE
AS/400
BYOD's Slippery Slope Disk DAC LUN Logical Drive
hdisk2 dac1 0 coenim_nim ASO
Power Systems Experts Weigh In hdisk3 dac1 1 coesap01_disk1 backup
The OpenPOWER Consortium can
========================= Best Practices
take Power in New Directions VIO server --> coevios2
More on the IBM PowerLinux
========================= Blades
Announcement ---dar0--- Capacity on Demand
An AIX on Power Performance User array name = 'COE-DS4700' Cell phone
Primer dac0 ACTIVE dac1 ACTIVE
Commands
Virtualization on Power Resources Disk DAC LUN Logical Drive
hdisk2 dac1 0 coenim_nim Computer mouse
hdisk3 dac1 1 coesap01_disk1
Archives Current Affairs
And here's a command that I ran in my environment:
Customer service
September 2013
./dshvio.ksh -r "lscfg | grep disk"
Daylight Savings Time
August 2013 =========================
VIO server --> vios1 Disaster Recovery
July 2013 =========================
DS6800
June 2013 vios1:/home/padmin # oem_setup_env
+ hdisk0 U787F.001.DPM1XRD-P1-T10-L3-L0 16 Bit DS8000
May 2013
LVD SCSI
DS8300
April 2013 Disk Drive (73400 MB)
+ hdisk1 U787F.001.DPM1XRD-P1-T10-L4-L0 16 Bit dual HMCs
March 2013 LVD SCSI
Disk Drive (73400 MB) Fibre cards
February 2013
+ hdisk2 U787F.001.DPM1XRD-P1-T10-L5-L0 16 Bit
Fibre Channel
January 2013 LVD SCSI
Disk Drive (73400 MB) FlexSystems Manager
December 2012 =========================
VIO server --> vios3 FLRT
=========================
SEPTEMBER 2013 FSC
vios3:/home/padmin # oem_setup_env
Sun Mon Tue Wed Thu Fri Sat FTP
* hdisk0 U787F.001.DPM1XRD-P1-C1-T1-
1 2 3 4 5 6 7 W5005076801103022-L0 Games
8 9 10 11 12 13 14 MPIO Other FC SCSI Disk Drive
15 16 17 18 19 20 21 * hdisk1 Geocaching
22 23 24 25 26 27 28 U787F.001.DPM1XRD-P1-C6-T1-W5005076801202FFF-
L1000000000000 MPIO Gmail
29 30
Other FC SCSI Disk Drive
GUI
* hdisk2 U787F.001.DPM1XRD-P1-C6-T1-
W5005076801202FFF- hard disk drives
MPIO Other FC SCSI Disk Drive
help desk
This means that I can run commands across all of my VIO
servers from my AIX machine, in either the padmin or HMC
oem_setup_env environment when I specify the -r option. I
HMC Scanner
welcome any changes or improvements that readers might
suggest, and I hope that Dean continues to share these useful HyperSwap
tools with us.
IBM
#!/bin/ksh
# Created by Dean Rowswell, IBM, April 26, 2006 IBM Electronic Support for AIX
# Modified by Dean Rowswell, IBM, October 11, 2007 and Power Systems
# Added a check for the -r flag for a root user command
IBM Flash System 820
# NOTE: this flag will require the expect RPM package to be
installed IBM i
# Modified by Dean Rowswell, IBM, October 12, 2007
# Added a check for the -n flag to specify a single or multiple IBM Power Champions
VIO servers
# IBM PureFlex
#---------------------------------------------------------------------- IBM storage
--------
# Assumption: this server is a trusted host for running ssh IBM Technical University
commands to
# the VIO server(s) IBM training sessions
# To set this up:
IM
# ssh-keygen -t dsa (press ENTER for all prompts)
# scp $HOME/.ssh/id_dsa.pub Integrated Virtualization
padmin@VIOserver:.ssh/authorized_keys2 Manager
#
# NOTE: if the VIO server responds with "rksh: ioscli: not IRC
found" then
IT Administration
# login to the VIO server and change to the root shell via
oem_setup_env. IT education
# Edit /etc/ssh/sshd_config
# Change: PermitUserEnvironment no IT Personnel
# To: PermitUserEnvironment yes
IVM
# Run: stopsrc -s sshd ; startsrc -s sshd
#---------------------------------------------------------------------- Jeopardy!
--------
#===========================================================# Keyboards
# Define the list of VIO servers in this variable
#===========================================================# Linear Tape Open
VIOS="vios1 vios3" Linux
#===========================================================#

http://ibmsystemsmag.blogs.com/aixchange/2008/05/another-great-a.html 9/27/2013
AIXchange: Another Great AIX Script Page 3 of 5

Live Partition Mobility


DisplayUsage() {
echo "Syntax: dshvio COMMAND\n Run dshvio -? for the valid LPAR
parameters"
LUN
exit
} microcode
if [ ${#*} -eq 0 ] mksysb command
then
DisplayUsage NAS
else
while getopts :rn: PARMS Nigel Griffiths
do
NIM
case $PARMS in
r) lslpp -L|grep -w expect >/dev/null nmon
if [ $? -ne 0 ]
then nmon analyzer
echo "ERROR: cannot use -r flag because expect\
NPIV
RPM package is not installed"
exit 1 Open storage
else
ROOT=1 OpenPOWER
fi ;;
Oracle database
n) VIOS=${OPTARG}
VIOS=`echo ${VIOS}|sed 's/,/ /g'`;; PC keyboards
?) echo "Valid parameters are:\n -r for a root
command\n\ POWER
-n for a list of VIO servers\n -n vios1\n -n vios1,vios2" ;
Power Champion
exit ;;
esac Power Systems
done
POWER7
shift $(($OPTIND -1))
VIOSCMD=${*} POWER7+
if [ ${#VIOSCMD} -eq 0 ]
then PowerHA
DisplayUsage
PowerLinux
fi
fi PowerVM

for VIO in ${VIOS} Redbooks


do
ping -c1 ${VIO} >/dev/null 2>/dev/null Remote Access
if [ $? -eq 0 ]
RSA tokens
then
echo "======================\nVIO server --> SAN
${VIO}\n\
======================" scripts
if [ ${ROOT:=0} -ne 1 ]
SCSI
then
ssh padmin@${VIO} "ioscli ${VIOSCMD}" SDMC
else
expect -c "spawn ssh padmin@${VIO} ;expect \"\$\*\";\ Security
send \"oem_setup_env\\r\";expect \"\#\*\";send
Smartphone
\"${VIOSCMD}\\r\";\
send \"exit\\r\";expect \"\$\*\";send \"exit\\r\""|egrep -v Solid State Drives
"^spawn\
|^Last|oem_setup_env|^exit|^#" SONAS
fi
else Storage
echo "===================\\nVIO server --> Support
${VIO}\n\
===================" SVC
echo "VIO server: ${VIO} is not responding"
fi Sysback
done
System Firmware
Posted at 08:25 AM in AIX | Permalink
System p

SystemMirror
TrackBack Systems Director

TrackBack URL for this entry: Systems Management


http://www.typepad.com/services/trackback/6a00d83545a5d153ef00e5521989e08833
Technical Conferences
Listed below are links to weblogs that reference Another Great
AIX Script: Technical Support

Television

Comments Time

Tivoli

topas
THis is a great idea
Travel
Posted by: Thomas | August 12, 2009 at 10:04 AM
TSM

Twitter
#!/bin/ksh
# Created by Dean Rowswell, IBM, April 26, 2006 UNIX
# Modified by Dean Rowswell, IBM, October 11, 2007
# Added a check for the -r flag for a root user command VIOS
# NOTE: this flag will require the expect RPM package to be
VIOS Advisor
installed

http://ibmsystemsmag.blogs.com/aixchange/2008/05/another-great-a.html 9/27/2013
AIXchange: Another Great AIX Script Page 4 of 5

# Modified by Dean Rowswell, IBM, October 12, 2007 viosbr


# Added a check for the -n flag to specify a single or multiple
Virtual disk
VIO servers
# Modified by Dean Rowswell, IBM, May 9, 2008 Virtual Fibre
# With VIOS 1.5.2 code - when this script is running a root
command the oem_setup_env virtualization
# command is coming back with a space and a backspace
sequence before the underscore VM
# Change the egrep pattern and add a grep command to deal VMware
with this
# VNC
# ---------------------------------------------------------------------
------------------ VOIP
# Assumption: this server is a trusted host for running ssh
vSCSI
commands to the VIO server(s)
# To set this up: Watson
# # ssh-keygen -t dsa (press ENTER for all prompts)
# # scp $HOME/.ssh/id_dsa.pub Web/Tech
padmin@VIOserver:.ssh/authorized_keys2
Weblogs
#
# NOTE: if the VIO server responds with "rksh: ioscli: not Wi-Fi
found" then login to the VIO
# server and change to the root shell via oem_setup_env. WPAR
Edit /etc/ssh/sshd_config
XIV
# Change: PermitUserEnvironment no
# To: PermitUserEnvironment yes YouTube
# Run: stopsrc -s sshd ; startsrc -s sshd
# ---------------------------------------------------------------------
------------------

#===================================================================================#
# Define the list of VIO servers in this variable
#===================================================================================#
VIOS="vios01 vios02 vios03 vios04 dr-vios01 dr-vios02"
#===================================================================================#

DisplayUsage() {
echo "Syntax: dshvio COMMAND\n Run dshvio -? for the valid
parameters"
exit
}

if [ ${#*} -eq 0 ]
then
DisplayUsage
else
while getopts :rn: PARMS
do
case $PARMS in
r) lslpp -L|grep -w expect >/dev/null
if [ $? -ne 0 ]
then
echo "ERROR: cannot use -r flag because expect RPM package is
not installed"
exit 1
else
ROOT=1
fi ;;
n) VIOS=${OPTARG}
VIOS=`echo ${VIOS}|sed 's/,/ /g'`;;
?) echo "Valid parameters are:\n -r for a root command\n -n for
a list of VIO servers\n -n vios1\n -n vios1,vios2" ; exit ;;
esac
done

shift $(($OPTIND -1))


VIOSCMD=${*}
if [ ${#VIOSCMD} -eq 0 ]
then
DisplayUsage
fi
fi

for VIO in ${VIOS}


do
ping -c1 ${VIO} >/dev/null 2>/dev/null
if [ $? -eq 0 ]
then
echo "VIRTUAL I/O SERVER --> ${VIO}"
if [ ${ROOT:=0} -ne 1 ]
then
ssh padmin@${VIO} "ioscli ${VIOSCMD}"
else
expect -c "spawn ssh padmin@${VIO} ;expect \"\$\*\";send
\"oem_setup_env\\r\";expect \"\#\*\";send \"${VIOSCMD}
\\r\";send \"exit\\r\";expect \"\$\*\";send \"exit\\r\""|egrep -v
"^spawn|^Last|^exit|^#"|grep -v "^$ oem"
fi
else
echo "VIRTUAL I/O SERVER --> ${VIO}"
echo "VIO server: ${VIO} is not responding"
fi
done
Posted by: Dean Rowswell | October 20, 2010 at 01:29 PM

http://ibmsystemsmag.blogs.com/aixchange/2008/05/another-great-a.html 9/27/2013
AIXchange: Another Great AIX Script Page 5 of 5

Post a comment
Comments are moderated, and will not appear until the author
has approved them.

Comment below or sign in with Typepad Facebook


Twitter Google+ and more...

(URLs automatically linked.)

Your Information

(Name and email address are required. Email address will not be
displayed with the comment.)

Name

Email Address

Web Site URL

Post Preview

• AIX
• IBM i
• Mainframe

• Home Page
• About Us
• Contact Us
• Subscriptions
• Reprints
• Advertise With Us
• Privacy Policy
• Terms of Service

IBM Systems Magazine is a trademark of International Business Machines Corporation. The editorial content of IBM Systems Magazine is placed on this
website by MSP TechMedia under license from International Business Machines Corporation.

© 2007 MSP Communications, Inc. All rights reserved

http://ibmsystemsmag.blogs.com/aixchange/2008/05/another-great-a.html 9/27/2013

You might also like