- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- favourite sysadmin scripts you always keep around....
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2002 08:01 AM
07-19-2002 08:01 AM
Re: favourite sysadmin scripts you always keep around....
---------------------------------------------
to get sar details on a machine on the next day, add the follwoing line in the crontab
0 * * * * /usr/lbin/sa/sa1 600 6
this will collect sar details for every 10 minutes and writes a file with the name sa
for ex: for today the file will be "sa19"
to view the details issue
#sar -f /var/adm/sa/sa19
in fact for todays file u can just issue "sar"
for a different file u need full path.
---------------------------------------------
to fine all the files which are more than 5mb
find . -size +5000000c -print
------------------------
regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2002 08:08 AM
07-19-2002 08:08 AM
Re: favourite sysadmin scripts you always keep around....
Just run as
cd /var/adm/sw/products
mv INDEX INDEX.old
indexgen >INDEX
Paga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2002 08:14 AM
07-19-2002 08:14 AM
Re: favourite sysadmin scripts you always keep around....
Much nicer to see than digging through [pv|lv|vg]display. :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2002 09:26 AM
07-19-2002 09:26 AM
Re: favourite sysadmin scripts you always keep around....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2002 02:28 PM
07-26-2002 02:28 PM
Re: favourite sysadmin scripts you always keep around....
I am not a scriptwriter and I want to thank you for starting this great forum. Why not push HP to give us some space on ITRC, where the SCRIPT GURU???S can put their script online. Sun has the same setup on their website where scripts can be uploaded to their site. Once again thanks for the good information.
Thanks,
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2002 04:46 PM
07-26-2002 04:46 PM
Re: favourite sysadmin scripts you always keep around....
Also thank everybody who give wonderful scripts here.
Good luck to all!
-Gerald-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2002 07:37 AM
07-30-2002 07:37 AM
Re: favourite sysadmin scripts you always keep around....
Here???s a little script I wrote for mass adding print queues from file. Especially useful when adding same set of queues on several systems belonging to one SAP R/3 installation.
Thanks,
--Grzegorz
#!/bin/sh
# Massadding printers with definitions in file
/usr/sbin/lpshut
for STRING in `cat $1`; do {
PRTNAME="`echo $STRING | awk -F\; '{print $1}'`"
HOST="`echo $STRING | awk -F\; '{print $2}'`"
PORT="`echo $STRING | awk -F\; '{print $3}'`"
echo "\nadding remote printer $PRTNAME with location $PORT on $HOST"
/usr/sbin/lpadmin -p$PRTNAME -orm$HOST -orp$PORT -mrmodel -v/dev/null -orc -ocmrcmodel -osmrsmodel
/usr/sbin/accept $PRTNAME
/usr/bin/enable $PRTNAME
} done
/usr/sbin/lpsched
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2002 11:10 PM
08-01-2002 11:10 PM
Re: favourite sysadmin scripts you always keep around....
Here is mine , i use this to archive files sent as attachments through uuencode.
Called from the aliases file
as archive :"|/local/bin/archive.sh"
later ..
#!/usr/bin/ksh
# script to save attached files sent to the aliases archive.
# Author B K Sagonda.
# 22-07-02
# run when they is mail addresed to archive
# SET ENVIRONMENT
. /etc/local.environ
archive_dir=${GLOBAL_BACKUP_DIR}/archives
cd $archive_dir || mkdir $archive_dir && chmod 755 $archive_dir
# END OF ENVIRONMENT
cd $archive_dir
mail_file=./mail_file.$$
cat - > $mail_file
# lets get from where the mail is comming from.
from=`awk '/^From:/ {print $NF}' $mail_file |sed 's///'`
# Lets get Subject .
subject=`awk -F: '/^Subject/ {print $NF}' $mail_file`
# decode the attached file ...
/usr/bin/uudecode $mail_file
# send an e-mail to the user ...
echo "
Your files have been archived.
Thanks.
" | mailx -s"Re:$subject" $from
rm -f $mail_file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2002 10:34 PM
08-22-2002 10:34 PM
Re: favourite sysadmin scripts you always keep around....
The attached script is from Tom Danzig. It enabled me to check the speed on all cards on my system.
Hope others will find it useful too.
Best Regards
Yogeeraj
============================================================
L1000: home/deg>./speed-lancard.sh
Card at PPA 0 - IP Address: 132.147.160.9 - Speed = 100 Half-Duplex Auto-Negotiation-ON
Card at PPA 1 - IP Address: 192.96.13.3 - Speed = 100 Half-Duplex
Card at PPA 2 - IP Address: Not assigned - Speed = 100 Half-Duplex
Card at PPA 3 - IP Address: 192.96.13.6 - Speed = 100 Half-Duplex
Card at PPA 4 - IP Address: Not assigned - Speed = 100 Half-Duplex
Card at PPA 5 - IP Address: 10.0.0.100 -
L1000: home/deg>
============================================================
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2002 03:21 PM
08-28-2002 03:21 PM
Re: favourite sysadmin scripts you always keep around....
Here is script that I think was written by Andreas Voss, one of the forms members and I am not sure if he has posted this in this form. Which mirrors the root volume groups. I found this script very useful. Great script does it all. I hope it???s Ok with Mr. Voss for me to post his work. If I have made mistake by posting this then I am sorry.
Thanks,
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 02:12 AM
08-29-2002 02:12 AM
Re: favourite sysadmin scripts you always keep around....
This is a script PERL that i use for getting usefull information about the SAN:
- Disk
- tape
Under this:
- N_port
- wwid
- HW path
- device if tape
#!/usr/bin/perl
open(LSTD,"ls /dev/td*|");
@array=
chop(@array);
close(LSTD);
foreach $linie (@array) {
print $linie,"\n";
open(FCMS,"fcmsutil $linie get remote all | grep N_Port_id |");
@fcmsArray=
chop(@fcmsArray);
close(FCMS);
foreach $linie2 (@fcmsArray) {
@arrayHex=split(/ +/,$linie2);
print $arrayHex[6],"\n";
open(FCMSTEST,"fcmsutil $linie get remote $arrayHex[6] | grep World |");
@fcmstestArray=
chop(@fcmstestArray);
close(FCMSTEST);
foreach $linie3 (@fcmstestArray) {
@fcmstestSplit=split(/ +/,$linie3);
print $fcmstestSplit[7],"\n";
}
@arrayHexSplit=split(//,$arrayHex[6]);
$hex1=join(/""/,$arrayHexSplit[2],$arrayHexSplit[3]);
$hex2=join(/""/,$arrayHexSplit[4],$arrayHexSplit[5]);
$hex3=$arrayHexSplit[6];
$hex4=$arrayHexSplit[7];
$number1=hex($hex1);
$number2=hex($hex2);
$number3=hex($hex3);
$number4=hex($hex4);
@decArray=join('.',"0",$number1,$number2,"255",$number3,$number4,"0");
foreach $linie4 (@decArray) {
print $linie4;
open(IOSCANHW,"ioscan -fuC tape | grep $linie4 |");
@ioscanHardwareAddr=
close(IOSCANHW);
@ioscanHardwareAddrSplit=split(/ +/,$ioscanHardwareAddr[0]);
if ($ioscanHardwareAddrSplit[2] eq "") {
print "\n\n";
next;
}
open(IOSCANDEVICE,"ioscan -funH $ioscanHardwareAddrSplit[2] | grep BESTnb |");
@device=
close(IOSCANDEVICE);
foreach $linie5 (@device) {
@deviceSplit=split(/ +/,$linie5);
foreach $linie6 (@deviceSplit) {
if ($linie6 eq "\n") {
print "\n";
next;
}
print $linie6,"\n";
}
}
}
}
}
BR,
Jannik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 02:33 AM
08-29-2002 02:33 AM
Re: favourite sysadmin scripts you always keep around....
This is a important link which speaks about porting shell scripts.
http://www.raycosoft.com/rayco/support/porting.html
And few shell scripts here.
http://www.introcomp.co.uk/examples/
regards,
U.SivaKumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 03:02 AM
08-29-2002 03:02 AM
Re: favourite sysadmin scripts you always keep around....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 09:04 AM
08-29-2002 09:04 AM
Re: favourite sysadmin scripts you always keep around....
This program will chop a file (or standard input) into blocks of 4 and compress each in parallel. On our 4 cpu N class system it gives gzip standard compression twice as fast as gzip.
WARNING, this program will use up to 400% cpu.
You need to have zlib installed on your system (get it from the porting center) and to compile it you need to use this command:
MP_NUMBER_OF_THREADS=4 cc +O4 +Oparallel -o pzip pzip.c zlib-1.1.4/libz.a -lpthread
Change the zlib.a path to your own installed location.
The uncompression routine will come in the next posting.
You may need to change it for your own purposes, for instance, the compression level.
It isn't compatible with gzip, since I couldn't figure out the format in RFC 1952. Also gzip format requires creation of a CRC which takes time. This program was written to enable pre-compression of backup streams before sending to the device. It helps when you have a small backup window and a lot of data to squeeze onto a small or slow tape device.
To use it, type
pzip < inputstream > outputstream
or use
pzip filename
where it will add a .pz onto the end.
Or even
tar cvf - /directory | pzip | dd bs=128k of=/dev/rmt/1m
It only gives better compression than a tape device if you change the compress2() calls to use standard or maximum compression.
If it fails to compress something it leaves it as it is returning a non-zero code. Files containing random data (entropy) always fail to compress, due their very nature. Most stuff is OK.
It doesn't work with wildcards, so to use on multiple files use xargs or a for loop such as
for F in *.unl
do
pzip $F
done
Zero length files are increased to 16 bytes, but that is mitigated by the large reduction in the size of large files and the speed of the algorithm as a whole.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 09:12 AM
08-29-2002 09:12 AM
Re: favourite sysadmin scripts you always keep around....
Testing was done on various files and diff/cmp have so far shown no difference from the previous uncompressed data to that which has been pzipped and punzipped.
To compile this program use:
cc +O4 -o punzip punzip.c zlib-1.1.4/libz.a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2002 12:24 AM
09-02-2002 12:24 AM
Re: favourite sysadmin scripts you always keep around....
On one of our hosts we have many pseudo-users that have crontabs. I use two very simple but effective scripts to deal with these crontabs:
showcron:
#!/usr/bin/sh
su ${1:?must specify userid} -c "crontab -l"
editcron:
#!/usr/bin/sh
su ${1:?must specify userid} -c "crontab -e"
It saves me a lot of typing.
Timo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 03:27 AM
09-06-2002 03:27 AM
Re: favourite sysadmin scripts you always keep around....
A simple script that monitor the login session of your server. add this at the end of /etc/profile.
# Notify Administrator for any login session
H=$(hostname)
USR=$(whoami)
TTY=$(who -mR)
echo "$H : $USR logged in at `date` from (`echo $TTY | awk '{print $6}' ` on `echo $TTY | awk '{print $2}'`)" | mailx -s"$H Login Monitor" sysad@yourmail.com
Joseph
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 03:48 AM
09-06-2002 03:48 AM
Re: favourite sysadmin scripts you always keep around....
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
Regards...
Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 04:00 AM
09-06-2002 04:00 AM
Re: favourite sysadmin scripts you always keep around....
find attached my script "cmpdisks" that can be used to scan all disks one ore more nodes for their LVM/VxVM IDs. It then groups the information into a table... especially useful to get get an idea about shared devices in clusters and SANs.
It also adds information about how the disks appear in /etc/lvmtab.
Example:
cmpdisks nero lola
Password (grcdg319.grc.hp.com:root):
Scanning host grcdg319 ....................
Scanning host hprtdd32
***** LVM-VG: 0557706517-0957278060
1 hprtdd32:c1t0d0 0557706517-0957278059 0/0/1/1.0.0 SEAGATE/ST39103LC (0x05/vg11.00/0557706517-0957278060)
***** LVM-VG: 0557706517-0986205681
1 grcdg319:c4t1d0 0630309352-0968061502 0/12/0/0.1.0 SEAGATE/ST118202LC (0x02/vgsap/0557706517-0986205681)
grcdg319:c5t1d0 0630309352-0968061502 0/12/0/1.1.0 SEAGATE/ST118202LC (0x02/vgsap/0557706517-0986205681)
hprtdd32:c4t1d0 0630309352-0968061502 0/6/0/0.1.0 SEAGATE/ST118202LC (0x01/vgsap/0557706517-0986205681)
hprtdd32:c5t1d0 0630309352-0968061502 0/6/0/1.1.0 SEAGATE/ST118202LC (0x01/vgsap/0557706517-0986205681)
2 grcdg319:c4t0d0 0630309352-0968061503 0/12/0/0.0.0 SEAGATE/ST118202LC (0x02/vgsap/0557706517-0986205681)
grcdg319:c5t0d0 0630309352-0968061503 0/12/0/1.0.0 SEAGATE/ST118202LC (0x02/vgsap/0557706517-0986205681)
hprtdd32:c4t0d0 0630309352-0968061503 0/6/0/0.0.0 SEAGATE/ST118202LC (0x01/vgsap/0557706517-0986205681)
hprtdd32:c5t0d0 0630309352-0968061503 0/6/0/1.0.0 SEAGATE/ST118202LC (0x01/vgsap/0557706517-0986205681)
***** LVM-VG: 0557706517-0986307905
1 hprtdd32:c2t0d0 0557706517-0986307878 0/0/2/0.0.0 SEAGATE/ST39103LC (0x00/vg00/0557706517-0986307905)
***** LVM-VG: 0557706517-1013696807
1 grcdg319:c4t8d0 0557706517-1013696757 0/12/0/0.8.0 SEAGATE/ST118202LC (n/a)
grcdg319:c5t8d0 0557706517-1013696757 0/12/0/1.8.0 SEAGATE/ST118202LC (n/a)
hprtdd32:c4t8d0 0557706517-1013696757 0/6/0/0.8.0 SEAGATE/ST118202LC (0x03/vg_bind90/0557706517-1013696807)
hprtdd32:c5t8d0 0557706517-1013696757 0/6/0/1.8.0 SEAGATE/ST118202LC (n/a)
***** LVM-VG: 0557706517-1015584303
1 hprtdd32:c8t12d0 0557706517-1015677736 0/3/0/0.8.0.255.1.12.0 SEAGATE/ST136403FC (n/a)
2 hprtdd32:c8t13d0 0557706517-1015677741 0/3/0/0.8.0.255.1.13.0 SEAGATE/ST136403FC (n/a)
***** XXX: UNCLAIMED
1 grcdg319:c0t6d0 unknown ??? unknown/unknown
grcdg319:c8t12d0 unknown ??? unknown/unknown
grcdg319:c8t13d0 unknown ??? unknown/unknown
***** XXX: ZEROSIZE
1 grcdg319:c0t1d0 unknown 0/0/1/0.1.0 HP/DVD-ROM 304
grcdg319:c4t10d0 unknown 0/12/0/0.10.0 SEAGATE/ST118202LC
grcdg319:c5t10d0 unknown 0/12/0/1.10.0 SEAGATE/ST118202LC
(hope, there will be no wrapping :-)
Regards...
Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 04:05 AM
09-06-2002 04:05 AM
Re: favourite sysadmin scripts you always keep around....
-- finding mem leaks from cli
You can monitor for memory leaks from the command line. Assuming your process is running in background or as a daemon, identify the PID by:
# ps -ef | grep
# # Note the PID
# #
# # in what
# # follows.
# export UNIX95=1 # Turns on XPG4
# # behavior of 'ps'
# # (needed for -o
# # option to work)
Now display physical and virtual size of the process:
# ps -p
If there is a memory leak, the values of sz (physical pages used) and vsz (virtual pages used) will gradually increase while the code executes.
Later,
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 04:47 AM
09-06-2002 04:47 AM
Re: favourite sysadmin scripts you always keep around....
here is a wonderful script that does the folowing:
shows the current time
the total uptime of the system
the run queue averages for the last 1, 5, 15 mins
total number of users logged on to the system
lists all users logged in
shows what terminal there on
shows what command they are running
tells you how long they have been idle
and heres the script:
----------->8 cut
#!/bin/ksh
w
----------->8 cut
;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2002 03:42 AM
09-12-2002 03:42 AM
Re: favourite sysadmin scripts you always keep around....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2002 02:09 AM
09-16-2002 02:09 AM
Re: favourite sysadmin scripts you always keep around....
Useful for remote training.
xwatchwin from hpux.cs.utah.edu does much the same (when it works)
as does qnc, hpvc and sharedx with a little more configuration.
Later,
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2002 07:30 AM
09-17-2002 07:30 AM
Re: favourite sysadmin scripts you always keep around....
just execute it it for command line options.
Later,
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2002 09:32 AM
09-17-2002 09:32 AM
Re: favourite sysadmin scripts you always keep around....
#!/usr/bin/sh
# fix permission/ownership according to IPD
[ "$#" -lt 1 ] && print "Usage: $0 [software_selections]" && exit 1
swlist -l file -a type -a mode -a owner -a group $@ |while read fset path type mode owner group dummy; do
if [ "$type" = f -o "$type" = d ]; then
print "Fixing ${path}: $mode $owner $group"
chown $owner:$group $path
chmod $mode $path
fi
done
Regards...
Dietmar.