Wednesday, November 11, 2009

Grrrrr!!!! Windows Stuff:Autoit

I know, I should have posted this thread 4 years back, when I saw this wonderful tool for the First time Used By Ram( My Friend). Though its a Windows Stuff but its worth mentioning this amazing Tool.
AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks

Here is the Home-Page of AUTOIT : http://www.autoitscript.com/autoit3/

Documentations are available in: http://www.autoitscript.com/autoit3/docs/

And there many more forums talk about autoit, do some googling and you'll find alot of scripts already writtern which you might want to use to automate your task.

Autoit is End-User License Agreement ("EULA") licensed that means you can download and install it for your personal as well Commercial use.


I assume no responsbility if using the contents of this page; breaks your system into pieces.
Leave me comments for improvements, if any.

Tuesday, September 22, 2009

OS Life-Cycle

A Quick referrence page for me to check the different OS Support Dates; since working on different OS Platforms and on different release dates; this page would help me tracking the EOL.
HP-UX Operating System: End of Sales & End of Factory Support

http://www.hp.com/softwarereleases/releases-media2/history/slide2.html

Good News: As I favor, HPUX ;-)
http://h71028.www7.hp.com/enterprise/cache/107846-0-0-0-121.html

HP9000 End Of Sales :-(
The last order date for HP9000 PA-RISC systems was December 31, 2008
The last order date for new HP9000 PA-RISC add-on options and upgrades will be December 31, 2009 and ship date of April 1, 2010


_________________________________________

SUN Solaris Operating System Life Cycle:


Solaris OS milestone releases come out approximately every 3 to 5 years, and are supported for a minimum of 10 years.

I'm Currently supporting upto Solaris 2.6 in my env. , following URL has all the details: you ever wish to see:

http://www.sun.com/service/eosl/eosl_solaris.html

You'd be dazed and amazed to see some more URL ;-)

http://www.sun.com/service/eosl/index.jsp

http://www.sun.com/service/eosl/software.jsp

http://www.sun.com/servicelist/in-ng.html


________________________________________
Red Hat Enterprise Linux Life Cycle:

Every major version of Red Hat Enterprise Linux is maintained and supported independently during the seven year life cycle

RedHat Enterprise Linux 2.1:
General Availability: May 17, 2002
End of Production 1 phase: Nov 30, 2004
End of Production 2 phase: May 31, 2005
End of Production 3 phase: May 31, 2009

RedHat Enterprise Linux 3:
General Availability: October 23, 2003
End of Production 1 phase: July 20, 2006
End of Production 2 phase: June 30, 2007
End of Production 3 phase: October 31, 2010

RedHat Enterprise Linux 4:
General Availability: February 14, 2005
End of Production 1 phase: March 31, 2009
End of Production 2 phase: No earlier than Q4 of 2009
End of Production 3 phase: February 29, 2012

RedHat Enterprise Linux 5:
General Availability: March 15, 2007
End of Production 1 phase: March 31, 2011
End of Production 2 phase: No earlier than Q1 of 2012
End of Production 3 phase: March 31, 2014

Referrence: http://www.redhat.com/security/updates/errata/
__________________________________

AIX Software Life Cycle:

http://www-01.ibm.com/software/support/lifecycle/index_a_z.html







I assume no responsbility if using the contennts of this page; breaks your system into pieces.
Leave me comments for improvements, if any.

Friday, August 21, 2009

EMC: inq usage to find LUN details

inq usage:

# inq -
Inquiry utility, Version V7.3-915 (Rev 0.0) (SIL Version V7.0.0.0 (Edit Level 915)Copyright (C) by EMC Corporation, all rights reserved.

For help type inq -h.

ERROR: - is an invalid option.

Usage: inquiry
display types:
-h : display this help screen
-et : display emulation and type info (Symmetrix only)
-ckd : display CKD device info (Symmetrix only)
-page0 : display detailed page0 (only valid with -dev option)
-pagec0 : display detailed pagec0 (only valid with -dev option and on CLARiiON devices)
-parent : display both PowerPath and OS device relationships
-celerra : display Celerra lable devices
-sid : display Symmetrix Serial Number
-sym_wwn : display Symmetrix device wwn and Serial Number
-clariion : display CLARiiON device information
-clar_wwn : display CLARiiON WWN and Serial Number
-showvol : display Symmetrix Volume Number.
-compat : display old format
-btl : display Bus Target and Lun
-sw_wwn : display StorageWorks WWN and Serial Id
-hds_wwn : display HDS WWN and Serial Id
-s80_wwn : display S80 WWN and Serial Id
-invista_wwn : display Invista WWN and Serial Id
-shark_wwn : display IBM Shark WWN and Serial Id
-compaq_wwn : display Compaq WWN and Serial Id
-netapp_wwn : display Netapp WWN and Serial Id
-hba : display HBA info only. See options below
-identifier : display device identifier info (EMC devices only)
-mapinfo : display target mapping information

filter options:
-no_filters : show every device even if no data available
-f_powerpath : filter - only powerpath devices
-f_pseudo : filter - only pseudo devices
-f_real : filter - only real devices
-f_emc : filter - only EMC devices
-f_ckd : filter - only ckd devices
-f_celerra : filter - only Celerra devices
-f_4k : filter - only Symmetrix volumes <>: filter - only show devices with <= size in kbytes

query options:
-skipread : do not request Read Capacity
-skipinq : do not request Inquiry data
-skipboth : do not request Read Capacity or Inquiry data
device options:
-dev : do inquiry on specified device
-symmvol : show devices with Symm HEX volume #=
-clar_file : show clariion devices in file

other options:
-no_dots : do not display status dots
-sortoff : do not perform ANY sorting
-sortsymm : sort by Symmetrix serial number (Symmetrix only)
sym_wwn options:
-sid_wwn : the 12 digit SID of the symm for which you want wwn's
-symdev : the device for which you want the wwn

HBA specific options:
-hba : display HBA info only
-fibre : display FC HBA info only
-iscsi : display ISCSI HBA info only
-scsi : display SCSI HBA info only
-hba_file : external HBA file to use. -fibre only
-create : create external HBA file specified by -hba_file
Usage :
inquiry -hba [-fibre [-hba_file ] [-create]] [-scsi] [-iscsi]
Release notes:
Only options listed above are supported, although other options may continue to work, they are subject to change or removal.

the following parameter changes have occurred
-nodots -> -no_dots
-c -> -ckd
-v -> -page0
-r -> -dev
-s SymmVolumeNumber -> -symmvol SymmVolumeNumber
-xr -> -f_pseudo
-xps -> -f_real
-system -> no longer exists

_________________________________________________________
I assume no responsibity if using the contents of this page; Breaks your systems into pieces.

Let Villagers be Happy!!

Wednesday, August 19, 2009

To check HBA FC Information on the System

Incomplete Page Yet to be Completed
Incomplete Page Yet to be Completed
Incomplete Page Yet to be Completed
Incomplete Page Yet to be Completed
Incomplete Page Yet to be Completed

AIX:

This page is a referrence page to get the details of System Adapter (HBA), Fiber-channel Devices configured in the system for me and the people who want to run some stupid commands to check the status of the said devices.

# To get the Machine Model:
> lscfg -vpl sysplanar0 grep -i "Model:"
# To list the FC Adapters
> lsdev -Cc adapter -spci grep fcs
fcs0 Available 05-08 FC Adapter
fcs1 Available 06-08 FC Adapter

# To Check the Current microcode level of FC adapter e.g. for fcs0
> lsmcode -cd fcs0
The current microcode level for fcs0 is 191105.

# To check the Firmware level of the FC e.g. for fcs0
> lscfg -vl fcs0 grep Z9
Device Specific.(Z9)........TS1.91A5

# To check the Driver Name of FC
> lsdev -C -Ftype,name grep -i fcs
df1000fa,fcs0
df1000fa,fcs1

# To check the installed Software
$ lslpp -l grep -i hba
devices.common.IBM.fc.hba-api
5.3.7.0 COMMITTED Common HBA API Library
devices.common.IBM.fc.hba-api
5.3.7.0 COMMITTED Common HBA API Library
$ lslpp -l grep "FC Software"
devices.common.IBM.fc.rte 5.3.7.0 COMMITTED Common IBM FC Software
5.3.0.60 COMMITTED Common IBM FC Software



# To get the WWN of FC: e.g. fcs0
lscfg -vl fcs0 grep Z8

Referrences for AIX man page(s) : lsmcode , lscfg , lsdev , lslpp

HPUX

To check the existing FS Adapter/Driver:
# ioscan -kfnC fc
There is a utility available to get the details for FC HBA under : /opt/fcms/bin/fcmsutils
Referrence for HP man pages : fcmsutil

Incomplete Page Yet to be Completed

Sunday, June 14, 2009

/var/preserve/Exaaa????? files on HPUX

Here is an example of files named Exaaa????? under /var/preserve on HPUX which occupies space, sometimes alot space and are found in larger no. These files are usually editor files from old vi session which aborts for any reasons. These files are kept here by system so that user can restore the file(s) from /var/preserve

On other Unix Flavors like AIX/Solaris ,you'll find the same files under /var/preserve

Here is an example of how to restore the file:

# vi -r
/usr/preserve/root:
On Wed Feb 18 at 15:10, saved 270 lines of file "catalina.sh"
/var/tmp:
No files saved.
# date ( Current Date)
Sat Jun 13 22:51:02 CDT 2009

Isn't it cool !!

Its time to delete old unnecessary files; so as Nike says Just do it

# ls -l Exaae00444 Exaag00444 Exaaf00444 Exaaa00401 Exaaa27641 Exaaa02088
-rw------- 1 root root 15556404 Dec 24 2001 Exaaa00401
-rw------- 1 root root 36528128 Nov 4 2007 Exaaa02088
-rw------- 1 root root 33611776 Dec 4 2001 Exaaa27641
-rw------- 1 root root 12195664 Dec 25 2007 Exaae00444
-rw------- 1 root root 13762908 Dec 25 2007 Exaaf00444
-rw------- 1 root root 12195664 Dec 25 2007 Exaag00444

Check the pwd , you should be under /var/preserve :
#rm Exaa*
or
# rm /var/preserve/Exaa*

What if you type :
# rm /var/preserve/Exaa * (one space left between Exaa and * )
Now guess what; Pack your Bag and Go to Home silently...
Do you know what happens; who cares...
Only one question left:
Did you do that???
and answer: God, Help me please confirm I've got a good Tape Backup ...Haan..





I assume no responsibiltity if using tips from this page; breaks your system down.

Saturday, June 13, 2009

How to Check the Network Settings

How to Check the Network Settings on the system:

On HPUX System:
run lanscan and get the lan card id
#lanadmin -sx 0
Speed = 100000000
Current Speed = 100 Full-Duplex Auto-Negotiation-OFF

On all the machines you can run $ `ifconfig -a` and get the nic card id
On Solaris System: ( Check for Solaris version, solaris 10 got dladm) Gotcha :-)
ndd -get /dev/hme link_speed
1 ( My NIC Card is set as 100mbps )
Legend: (0=10mbps 1=100mbps 1000=1gbps)

ndd -get /dev/hme link_mode
1 ( My NIC Card is set as Full Duplex)
(0=Half Duplex 1=Full Duplex)

For Solaris 10 systems:
#dladm show-dev
bge0 link: up speed: 100 Mbps duplex: full
bge1 link: down speed: 0 Mbps duplex: unknown

On AIX System:
$ entstat -d en4 grep -i med
Media Speed Selected: 100 Mbps Full Duplex

On Linux System: ( Checked on Red-Hat need to check in SuSE)
Need to try these commands; its been while I ran (missing output :-( )
mii-tool
ethtool


and let villagers be happy with your findings...

Tuesday, June 9, 2009

What's Happening Part - I (HPUX LVM 2.x)

Starting a new thread which will talk about the new technology changes:

Abstract from http://docs.hp.com/en/lvm-v2/L2_whitepaper_8.pdf



Introduction of HPUX LVM 2.x
The 2.0 volume groups became available with the March 2008 release of HP-UX 11i v3 (11.31) and the 2.1 volume groups with the 11i v3 2008 September release. Prior to the March 2008 release, only version 1.0 volume groups were available.



Notable Difference(s)/Enhancement(s):

1)Automatic creation of the volume group directory and group file is available starting with the March 2008 release of HP-UX 11i. It is available for 1.0 and 2.x volume groups

2) No. Of mirror Copies increased from 2 to 5 in LVM 2.x

3) You can have /etc/lvmtab and /etc/lvmtab_p

4) New Command : lvmadm ,

5) Boot, dump and primary swap not supported on 2.x resulting 2.x volume group cannot be used to save crashdumps.

6) Bad blocks not supported on 2.x

7) Commands not supported on 2.x volume groups :

vgmodify (1M), lvrmboot(1M), lvlnboot(1M), pvck(1M)

Saturday, May 23, 2009

Is My System running 32bit or 64bit OS?

Simple answer would be to check if you can find Dianosours around you, If you find it ; you're running 32bit OS.

For HPUX System:
/usr/bin/getconf KERNEL_BITS

Check the man page for more info about getconf(1) like: MACHINE_SERIAL,HW_CPU_SUPP_BITS

For Solaris Systems:
/usr/bin/isainfo -v
For more information please check the man page isainfo

For AIX Systems:
bootinfo -k

For RedHat Linux System:
getconf LONG_BITS

64bit Kernel will respond 64 else find the Dinasours.
Another way to check if the system is running 64bit kernel to check flag `lm` in `cat /proc/cpuinfo`

Tuesday, March 10, 2009

HPUX Tips

Some HPUX Tips Collected from different itrc threads from HP.


Command to show top ten CPU users on the system

# UNIX95= ps -e -o "vsz pcpu ruser pid stime time state args" sort -rn head -10


To get Yesterday

perl -e '$yesterday = localtime(time-24*60*60),print "$yesterday\n"'
perl -e '$yesterday = localtime(time-86400),print "$yesterday\n"'
perl -le 'print scalar localtime time - 86400'


Disk related Stuff

######### To find out from which disks OS booted From #########
#echo boot_string/s adb /stand/vmunix /dev/kmem

######### To find out if there are Stale in LVs #########
# /usr/sbin/vgdisplay -v awk '/LV Name/ { print $3 }' xargs /usr/sbin/lvdisplay -v grep -i -e "lv name" -e "lv status" -e stale -e '?'

######### To find out timestamp when the kernel was built/linked #########
# echo "linkstamp?s" adb /stand/vmunix

######### To get the LVM PVID and VGID from a disk #########
To get the LVM PVID and VGID from a disk. Please note that each unique ID consists of 2 longs (2 x 4 Bytes). The 1st long is a host ID (uname -i) and 2nd long is a timestamp. So the PVID tells you when some issued a pvcreate from what machine. The VGID does the same for the vgcreate.
PVID e.g::
# echo "0d8200?UY" adb /dev/dsk/c0t6d0
2008: 2010702141 2002 Jan 2 10:31:16
VGID e.g.:
# echo "0d8208?UY" adb /dev/dsk/c0t6d0
2010: 2010702141 2002 Jan 2 07:29:06

######### To get free space (Size in MB ) on all Volume Groups in a system #########
/usr/sbin/vgdisplay egrep -i 'VG NamePE SizeFree PE' awk 'BEGIN {print "VGname Free_space(MB)"} {a=$NF;getline;b=$NF;getline;c=$NF;print a,b*c}'

######### To get man pages in printable format #########
# man ls col –b ssp expand


CSTM/STM Stuff

####CPU boards:####
echo "selclass qualifier cpu;info;wait;infolog" /usr/sbin/cstm

####LAN cards:####
echo "selclass qualifier lan;info;wait;infolog" /usr/sbin/cstm

####Memory:####
echo "selclass qualifier memory;info;wait;infolog" /usr/sbin/cstm


####Disks:####
#echo "selclass qualifier disk;info;wait;infolog" /usr/sbin/cstm
#echo "selclass qualifier cpu;info;wait;infolog"cstm > /tmp/cpu.info
#echo "sel path system\ninfolog\nexit"cstmgrep "System Serial Number"
# echo "selclass type disk;info;wait;infolog" /usr/sbin/cstm grep "Serial Number"

How to check if largefiles are set

# mkfs -F vxfs -m /dev/vgxx/lvolx
# fsadm -F hfs /dev/vgxx/lvolx (hfs filesystem)
# fsadm -F vxfs /mountpoint


moving disk across system
( Old Method for LVM1.0) my old page ;-)

vgchange -a n /dev/vgXX
vgexport -p -v -m plan_map /dev/vgXX (Preview)
vgexport -v -m plan_map /dev/vgXX
add the disk
ioscan -fnC disk
cd /
mkdir /dev/vgXX
cd /dev/vgXX
mknod /dev/vgXX/group c 64 0xNN0000
vgimport -p -v -m plan_map /dev/vgXX /dev/dsk/c0t0d0…..(Preview)
vgimport -v -m plan_map /dev/vgXX /dev/dsk/c0t0d0…..






One Liner

######Remove control-M's from a windows text file.######
cat $1 tr -d "\015"

######To strip out unprintable characters from a file.######
#cat myfile tr -Acd "[[:print:]][\012]" > newfile

######Remove control-M's from a windows text file.######
cat $1 tr -d "\015"

######Error Code Library.######
/usr/include/sys/errno.h

######Shows LV Status and Stale PEs on LV######
# /usr/sbin/vgdisplay -v awk '/LV Name/ { print $3 }' xargs /usr/sbin/lvdisplay -v \ grep -i -e "lv name" -e "lv status" -e stale -e '?'

######CPU Speed.######
#echo itick_per_usec/D adb -k /stand/vmunix /dev/kmem

######you can check the fs_async paramater with.######
echo "fs_async/D" adb -k /stand/vmunix /dev/kmem

######Shows OS install date######
#swlist -a install_date -l product grep -i os-core

######From which Disk system BootED.######
# echo "linkstamp?s" adb /stand/vmunix

######lsof ######
# # lsof +aL1 /tom

######Man Page Reformat.######
# # man ls col –b ssp expand

######Use adb to query the kernel for the size of physical memory.######
# echo phys_mem_pages/2d adb /stand/vmunix /dev/kmem ( For 11.23)
# echo phys_mem_pages/D adb -k /stand/vmunix /dev/mem (For 11.11)
# echo physmem/D adb -k /stand/vmunix /dev/mem (For 10.x) b. multiply output of adb by 4096 to get the size of RAM.

# To see large file support f_flag: 16 large files are activated f_flag: 0 large files are inactive # /usr/sbin/fstyp -v /dev/vgxx/lvolxgrep f_flag

########## Script to get CSTM version from multiple servers ######
# echo "selclass qualifier cpu;infolog" /usr/sbin/cstm grep Version
# remsh 'echo "exit" /usr/sbin/cstm grep "Version "'
# remsh remotesys '/usr/sbin/cstm < /dev/null' grep "^Version"

Create a new software depot for patches
Creating a separate software depot for your patches is useful, when space is tight and patches have dependencies.
Assuming you have two patches PHNE_20000 and PHNE_20001. unshare all two patches by typing the following commands.
sh PHNE_20000
sh PHNE_20001
Next, we have to create a new software depot on the directory
/newdir/depot
mkdir /newdir/depot
swpackage -s PHNE_20000.depot -d /newdir/depot
Register your new depot on the sd-ux.
swreg -l depot /newdir/depot
Copy the next patch to the newly created software depot.
swcopy -s `pwd`/PHNE_20001.depot PHNE_20001 @ /newdir/depot
You are now ready to install your patches
swinstall -s /newdir/depot




And Villagers were
happy ever after....

Enable XDMCP Connection to Redhat Linux Machines:

By Default XDMCP Connections are disabled on RedHat Linux.

Follow the url to see the steps to enable the xdmcp connection:

http://www.geocities.com/parwatraj/xdmcp.htm

Firmware upgrade - HP rp3410

Follow the steps to upgrade firmware , Here we have taken an example of model HP rp3410




Click on "Download drivers, software and firmware" on the left hand side of the page
Enter the Model of the HP Server you're going to upgrade.

# model



Follow the screen and select the HP Server Model.


Follow the screen and select the correct Operating System Version...






Select the appropriate catagory to download the software for firmware upgrade.
You'll find the description for all the catagories which includes Type of S/w, version, OS, systems where you can apply the firmware upgrade , installation readme instructions and a lot more.
_____________________________________________________________
Installation instructions:
A) Clear the system event logs
1. Establish a telnet session with the MP.
2. Logon to the MP using the Admin password.
3. Type SL to enter the Show Logs menu.
4. At the "Enter menu item or [Ctrl-B] to Quit:" prompt type "c"
5. At the "Are you sure you want to clear all logs? (Y/[N]):" prompt type "y"
5. The following should be displayed:
-> Logs have been cleared.
b) Unpacking the firmware on an HP-UX system:
1. FTP PF_CEVERMPE0315.tar.gz to an empty directory on an FTP server.
2. Use 'gunzip' to unzip the patch: # gunzip PF_CEVERMPE0315.tar.gz
3. Use the 'tar' command to extract the firmware files: # tar -xvf PF_CEVERMPE0315.tar
x Resources.out, 1109367 bytes, 2167 tape blocks
x E0315.bin, 3281836 bytes, 6410 tape blocks
x mp_upg.cnf, 202 bytes, 1 tape blocks
x version.dat, 16 bytes, 1 tape blocks
4. Verify the checksum of the firmware files using the 'cksum' command. Results of the command should be equal to the shown output: # cksum
1981893873 1109367 Resources.out
1868532509 3281836 E0315.bin
1633706411 202 mp_upg.cnf
439768612 16 version.dat
5. Proceed to "Test the network connection to the FTP server" instructions
----------------------------------------------------
Test the network connection to the FTP server:

1. Establish a telnet session with the Management Processor.
2. Logon to the Management Processor using the Admin password.
3. Type ^Ecf to get console write access.
4. Type ^b to enter the Management Processor.
5. Ping the LAN where the MP files are located via the XD command item #3
(LAN access PING).
MP:CM> xd
XD
Diagnostics Menu:
Non destructive tests: P - Parameter checksum
I - I2C access (get BMC Device ID record)
L - LAN access (PING)
M - Modem selftests
Destructive tests:
R - Restart MP
Enter menu item or [Q] to Quit: L
L
Enter IP Address: xxx.xxx.xxx.xxx
6. Reset the MP via the XD command (use the R option). This will free up any unallocated memory for the MP update. -> Choice: r
r
The MP is now being reset...
6. Proceed to “Installing E.03.15 MP Firmware" instructions
--------------------------------------------------------------
Follow the URL to see the complete log file of Firmware upgrade on rp3410 running 11.11.








Monday, March 9, 2009

Raid Levels - Not Mine



( Click on the image to enlarge )
Surely this image is not owned by me, but I find it good to understand the different RAID Levels.


For serious reading about RAID; you may find good info on http://en.wikipedia.org/wiki/Redundant_array_of_independent_disks



Thursday, February 26, 2009

Solaris Zone Basics

# uname -a
SunOS nido 5.10 Generic_118844-26 i86pc i386 i86pc

# pwd
/
create a Zone
# zonecfg -z
nidoz3: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:nidoz3> create
zonecfg:nidoz3> set autoboot=true
zonecfg:nidoz3> set zonepath=/nidoz3
zonecfg:nidoz3> add net
zonecfg:nidoz3:net> set address=137.72.420.420/24
zonecfg:nidoz3:net> set physical=e1000g0
zonecfg:nidoz3:net> end
zonecfg:nidoz3> verify
zonecfg:nidoz3> commit
zonecfg:nidoz3> exit
#
# zoneadm list –cv
# cat /etc/zones/nidoz3.xml
# mkdir /nidoz3
# chmod 700 /nidoz3
# zoneadm -z nidoz3
# zoneadm -z nidoz3 install
#zoneadm list –cv

#zoneadm -z nidoz3 boot
#zoneadm list -cv
#zlogin -C nidoz3

Add File-System: Mount FileSystem in Global Zone:
zonecfg:nidoz3> add fs
zonecfg:nidoz3:fs> set dir=/opt
zonecfg:nidoz3:fs> set special=/nidoz4_1/opt
zonecfg:nidoz3:fs> set type=lofs
zonecfg:nidoz3:fs> set options=rw,nodevices
zonecfg:nidoz3:fs> end

Remove a FileSystem in Non-Global Zone
global# zonecfg -z zonename
remove fs dir=/usr/local/mysql/data

To get the Non-Global Zone Information:
# cat /etc/zones/nidoz3.xml
Or
zonecfg:nidoz1> info
Or
# zoneadm list –cv
Or
# zonecfg -z nidoz1 export

To Set the IP Address for Non-Global Zone
ifconfig e1000g0:3 plumb 137.72.420.420 netmask 255.255.255.0 zone nidoz3 up

To Delete a Non-Global Zone:
# zoneadm list –cv
# zoneadm -z nidoz3 halt
# zoneadm list –cv
# zoneadm -z nidoz3 uninstall
# zoneadm list –cv
# zonecfg -z nidoz1 delete
# zoneadm list –cv
-----------------------------------------------------------------------------------------
Refer the Following URL for zone create script: (Not tested yet but will soon be )

timepass - Ping Host Table

#!/bin/ksh
clear
echo "Do you want to flush the log data before running ping test (y/n): "
read choice
case $choice in
y)
cat /dev/null > /tmp/pnaidu/err.txt
cat /dev/null > /tmp/pnaidu/ok
cat /dev/null > /tmp/pnaidu/NOTOK

for A in `awk '{print $1}' /script/testpnhost.txt`
do
ping ${A} -n 1 >>/tmp/pnaidu/out.txt 2>>/tmp/pnaidu/err.txt
if [ $? = 0 ]; then
{
echo "${A} is able to connect" >> /tmp/pnaidu/ok
}
else
{
echo "${A} NOT able to connect" >> /tmp/pnaidu/NOTOK
}
fi
done
echo "Hosts which couldn't ping throw them all from the 7th Floor"
echo "Check the log files under /tmp/pnaidu \n "


;;

n)
echo "Hasta la vista"
exit 0
;;
*)
echo "Invalid Choice "
echo "Exiting....... Wake up and get a cup of coffee"
exit 1
esac

expect scripting

Nice way to start expect would be to first visit: http://expect.nist.gov/

Expect is mainly used to automate the task for some applications which require manual interaction such as telnet, ftp, passwd, fsck, rlogin, tip, etc.

Enough of the introduction part for expect.


Example(1): will telnet to a host named as `nido` it'll put login and password credentials and then will surely can run either of the commands ( I know, one command will fail)...

_______________________________________________

#!/usr/local/bin/expect
spawn telnet nido
expect "login"
send "root\r\n"
expect "Password:"
send "whoami\r\n"
expect -re {\#}
send "/usr/contrib/bin/machinfo| mailx parwatraj@yahoo.com/r"
expect -re {\#}
send "ls -l\r"
expect -re {\#}
send "/opt/ignite/bin/print_manifest| mailx parwatraj@yahoo.com/r"
expect -re {\#}
exit
_______________________________________________________
Example(2): will telnet or ssh to a list of hosts which are in a text file `/script/testpnhost.txt` and will do the same task as we've seen on the above example.
Excute testpn4 and see how it works for you.
Modify the contents of expect script as per your need.

---------------------------------------
# cat testpn4
#!/bin/sh
for A in `cat /script/testpnhost.txt`
do
echo ${A}
echo "__________________________"
/script/testpn5.exp ${A}
done
---------------------------------------------------------------

# cat testpn5.exp
#!/usr/local/bin/expect
spawn telnet [lindex $argv 0]
expect "login"
send "root\r\n"
expect "Password:"
send "whoami\r\n"
expect -re {\#}
send "/usr/contrib/bin/machinfo| mailx parwatraj@yahoo.com/r"
expect -re {\#}
send "/opt/ignite/bin/print_manifest| mailx parwatraj@yahoo.com/r"
expect -re {\#}
exit
---------------------------------------------------------------------

Thursday, February 19, 2009

test

Page created by me is stolen and posted on www.geocities.com/sanjeev-hcl