Tuesday, September 16, 2008

Solaris 10 login to zone console

login to global zone

# zoneadm list -vc
ID NAME STATUS PATH
0 global running /
1 zone1 running /zone/1


# zlogin -C -e\@ zone1
[Connected to zone 'zone1' console]

zone1 console login:

zone1 console login:

zone1 console login: @.
[Connection to zone 'zone1' console closed]
#

VXVM: determine current booted disk

% prtconf -vp | grep bootpath

VXVM: quickly mirroring an empty volume

Use the command below to create empty mirrored volume

# vxassist make newvol 10m layout=concat-mirror init=active disk1 disk2

Friday, September 12, 2008

Solaris v440 replace failed power supply

Need to login to System Controller
sc>
SC Alert: PSU @ PS1 has FAILED.

sc> removefru PS1
Are you sure you want to remove PS1 [y/n]? y
sc>
SC Alert: PSU @ PS1 has FAILED.

SC Alert: PSU @ PS1 has FAILED.

SC Alert: PSU @ PS1 has FAILED.

SC Alert: PSU @ PS1 has been removed.

SC Alert: Required PSU @ PS1 is not present.

SC Alert: PSU @ PS1 has been inserted.

sc> poweron PS1
sc>

Monday, September 8, 2008

HPUX How to check if patch have been installed and install the patch

let say we want to check for this patch
phkl_36745 and phne_37489

# swlist -l patch | grep -i phkl_36745
PHKL_36745.LVM-KRN 1.0 LVM.LVM-KRN applied
PHKL_36745.CORE2-KRN 1.0 OS-Core.CORE2-KRN applied
# PHKL_36745 1.0 LVM Cumulative Patch
# PHKL_36745.CORE2-KRN 1.0 OS-Core.CORE2-KRN applied
# PHKL_36745.LVM-KRN 1.0 LVM.LVM-KRN applied
# swlist -l patch | grep -i phne_37489
#

This shows that patch phkl_36745 is installed and phne_37489 is not installed yet

1. Back up your system before installing a patch.

2. Login as root.

3. Download and Copy the patch to the /tmp directory.

4. Move to the /tmp directory and unshar the patch:

cd /tmp
sh PHNE_37489

5. Run swinstall to install the patch:

swinstall -x autoreboot=true -x patch_match_target=true \
-s /tmp/PHNE_37489.depot

By default swinstall will archive the original software in
/var/adm/sw/save/PHNE_37489. If you do not wish to retain a
copy of the original software, include the patch_save_files
option in the swinstall command above:

-x patch_save_files=false

WARNING: If patch_save_files is false when a patch is installed,
the patch cannot be deinstalled. Please be careful
when using this feature.

For future reference, the contents of the PHNE_37489.text file is
available in the product readme:

swlist -l product -a readme -d @ /tmp/PHNE_37489.depot

To put this patch on a magnetic tape and install from the
tape drive, use the command:

dd if=/tmp/PHNE_37489.depot of=/dev/rmt/0m bs=2k

Friday, September 5, 2008

HPUX check network interface ip and status

# lanscan
Hardware Station Crd Hdw Net-Interface NM MAC HP-DLPI DLPI
Path Address In# State NamePPA ID Type Support Mjr#
0/1/2/0 0x00156004DF56 0 UP lan0 snap0 1 ETHER Yes 119
VLAN5001 0x00156004DF56 5001 UP lan5001 snap5001 7 ETHER Yes 119
VLAN5000 0x00156004DF56 5000 UP lan5000 snap5000 6 ETHER Yes 119
0/1/2/1 0x00156004DF57 1 UP lan1 snap1 2 ETHER Yes 119
0/5/1/0 0x00163584E02A 2 UP lan2 snap2 3 ETHER Yes 119
#
# ifconfig lan0
ifconfig: no such interface
# ifconfig lan2
ifconfig: no such interface
# netstat -i
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
lan5001 1500 172.30.225.0 mama201-nb 2531362 0 18691869 0 0
lan5000 1500 142.133.20.0 mama201 1388313474 0 1440717679 0 0
lo0 4136 loopback localhost 30234682 0 30234690 0 0
# ifconfig lan5001
lan5001: flags=4000000000001843
inet 172.30.225.26 netmask ffffff00 broadcast 172.30.225.255
#j

Sudoers Example: su - root

As root
#visudo
add below lines, where user123 is uid that need su - privillage
user123 ALL=(ALL) /usr/bin/su -
user124 ALL=(ALL) /usr/bin/su -
user125 ALL=(ALL) /usr/bin/su -
user126 ALL=(ALL) /usr/bin/su -
:wq!

as user123
user123% sudo su -
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these two things:

#1) Respect the privacy of others.
#2) Think before you type.

Password:

Authorized access only!

root#

UNIX: How to print column nicely using printf

[user@hostfwnms1-oam tmp]# cat b.sh printf "%-26s %-19s %-8s %-8s %-s %-s\n" HOSTNAME IP PING SNMPWALK 0-ok 1-fail for i in `cat n...