Operating System - HP-UX
1753331 Members
5174 Online
108792 Solutions
New Discussion юеВ

Re: Submit you HP-Ux tips and tricks and win easy 10points

 
SOLVED
Go to solution
Jason Berendsen
Regular Advisor

Re: Submit you HP-Ux tips and tricks and win easy 10points

An easy way to get yesterdays date instead of writing a 30 line script.

YESTERDAY=$(TZ=$(date +%Z)+24; date '+%b %e')

This has been very usefull for me with backups.
Animesh Chakraborty
Honored Contributor

Re: Submit you HP-Ux tips and tricks and win easy 10points

Move or delere all files under a directory older hat 15 days.
#find /ctx/sap/interface/cnzl -mtime +15 -exec mv {} /temp

A good command to copy a file system to a new directory.
#cd /sourc_dir
#find . -depth -print|cpio -pdmv /dest_dir

Did you take a backup?
Michael Tully
Honored Contributor

Re: Submit you HP-Ux tips and tricks and win easy 10points

Since I've been like "Bob the Builder" lately,
and been mirroring new systems disks.

# pvcreate -B /dev/rdsk/c2t6d0
# vgextend /dev/vg00 /dev/dsk/c2t6d0
# mkboot /dev/rdsk/c2t6t0
# mkboot -a "hpux -lq(;0)/stand/vmunix" /dev/rdsk/c2t6d0
# lvlnboot -R
# for LVOL in /dev/vg00/lv*
> do
> echo $LVOL
> lvextend -m 1 $LVOL
> done
Anyone for a Mutiny ?
Kenny Chau
Trusted Contributor

Re: Submit you HP-Ux tips and tricks and win easy 10points

Tip 1 - Never let the HP Engineer left before the system back to normal after repair (Sorry to all HP Engineers), this is what my manager said.
Tip 2 - In cluster environment, before shutdown any node, disable all packages switching, halt node and shutdown the node.
Tip 3 - If adding or removing disks from SC10, remember to shutdown all machines which connected to the SC10 and also shutdown the SC10 before removing or adding disks.

Good luck.
Kenny.
Kenny
Michael Tully
Honored Contributor

Re: Submit you HP-Ux tips and tricks and win easy 10points

Removing tapes from my tape library with OmniBack.

Attached is a fairly simple script to do this. It is really handy if you don't have a tape jockey.

-Michael
Anyone for a Mutiny ?
Printaporn_1
Esteemed Contributor

Re: Submit you HP-Ux tips and tricks and win easy 10points

if you suscpect networking problem , like IP address conflict:

#netfmt -t 50 -f /var/adm/nettl.LOG00 > /tmp/nettl

then check /tmp/nettl
enjoy any little thing in my life
Printaporn_1
Esteemed Contributor

Re: Submit you HP-Ux tips and tricks and win easy 10points

system panic / core dump reading overview.
HP-UX 11.0 already have q4 package in /usr/contrib/bin

1. cd /var/adm/crash/crash.0
#/usr/contrib/bin/q4prep
q4 library files being created in /var/adm/crash/crash.0/q4lib

2.cd q4lib
#cp sample.q4rc.pl ~/.q4rc.pl
3. cd ..
#q4 -p
@(#) q4 $Revision: 1.79a $ $Date: 97/09/08 12:00:22 $ 0
Reading kernel symbols ...
Reading kernel data types ...
Initialized PA-RISC 2.0 address translator ...
Initializing stack tracer ...
Get the latest Q4 news by typing "news".

q4> include analyze.pl
loading ./q4lib/analyze.pl ...
loading ./q4lib/uname.pl ...
loading ./q4lib/misc.pl ...
loading ./q4lib/uptime.pl ...
loading ./q4lib/adjust.pl ...
loading ./q4lib/messagebuffer.pl ...
loading ./q4lib/addresses.pl ...
loading ./q4lib/tables.pl ...
loading ./q4lib/processors.pl ...
loading ./q4lib/crashes.pl ...
loading ./q4lib/rpb.pl ...
loading ./q4lib/traces.pl ...
loading ./q4lib/globals.pl ...
loading ./q4lib/processes.pl ...
loading ./q4lib/commands.pl ...
loading ./q4lib/credentials.pl ...
loading ./q4lib/threads.pl ...
loading ./q4lib/user.pl ...
loading ./q4lib/vm.pl ...
loading ./q4lib/vm_vfddbd.pl ...
loading ./q4lib/files.pl ...
loading ./q4lib/vfs.pl ...
loading ./q4lib/inode.pl ...
loading ./q4lib/buf.pl ...
q4>run Analyze UAP > ana.out

-----
then waiting till finish , or in another session
cd /var/adm/crash/crash.0
vi ana.out
search for stack


Stack trace from the first crash event:
stack trace for event 0
crash event was a TOC
FUNC PC SP FMP SSP
idle+0xa78 0.0x135a60 0.0x0'0d20c1f0 0.0x0'0d20c1e0 n/a
swidle_exit+0x0 0.0x1380ac 0.0x0'0d20c050 0.0x0'0d20c040 n/a

==================
now check patch database for similar stack.
you may come up with patches installation to fix this panic.
enjoy any little thing in my life
Scott Van Kalken
Esteemed Contributor

Re: Submit you HP-Ux tips and tricks and win easy 10points

This is a favourite of mine for a vgcfgbackup before you run your daily backup.

#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin

VG=$(vgdisplay |grep "VG Name" |awk '{print $NF}')
HOSTNAME=$(hostname)
logger -p local0.info "INFO: LVM backups for host <$HOSTNAME> starting..."
for v in $VG ; do
vgcfgbackup $v
if [ $? -ne 0 ] ; then
logger -p local0.err "ERROR: LVM backups failed..."
fi
done
logger -p local0.info "INFO: LVM backups for host <$HOSTNAME> finished..."
Marc Dijkstra
Trusted Contributor

Re: Submit you HP-Ux tips and tricks and win easy 10points

Wodish, I see Bill did not put his memory usage in! Used it last night to find some rather nasty memory leaks on an 11.00 box (the famous mib2agt leak)

UNIX95= ps -e -o ruser,vsz,pid,ppid,args|sort -rnk2 |more

This gives the total memory usage per process.

P.S: That mib2agt leak is fixed with the new OV EMANATE142 patch PHSS_24945.

MND
"A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila"
Stefan Farrelly
Honored Contributor

Re: Submit you HP-Ux tips and tricks and win easy 10points


Heres a script even a non root user can run to see how much free memory is on a box;

let x=$(grep -i physical: /var/adm/syslog/syslog.log|head -1|awk '{print $7}')/1048
let z=$(vmstat|tail -1|awk '{print $5}')*4096;let z=$z/1000000
let free=100000/$x*$z
let free=$free/1000
let free=100-$free
echo "$x Mb physical memory \n$z Mb memory free \n$free % used"

And a nifty C program to move a running process onto a particular CPU - great on servers with many CPU's and some process is hogging CPU 0 - which HP-UX really needs to use to keep everything running fast....

Cheers,

Stefan


#include
#include
#include
#include
#include

main(argc,argv)
int argc;
char *argv[];
{
gid_t sgid;
int i;
int pid;

if (argc < 2) {
printf("Usage: setproc spunum pid0 [pid1 ... pidn]\n");
exit(1);
}
sgid = atoi (argv[1]);
i = argc;
printf("Attempting to set process affinity for processor %d\n",sgid);
while (i-- >2) {
pid = atoi(argv[i]);
if ((sgid = SETPROCESS(sgid, pid)) < 0)
perror("setprocess failed");
printf ("processor %d pid = %d\n", sgid, pid);
}
}

Im from Palmerston North, New Zealand, but somehow ended up in London...