- 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-02-2002 05:57 AM
07-02-2002 05:57 AM
Re: favourite sysadmin scripts you always keep around....
An script to send an e-mail with one or more bodies, one or more enclosed files and subject. To one ore more e-mail address.
Regards,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2002 05:58 AM
07-03-2002 05:58 AM
Re: favourite sysadmin scripts you always keep around....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2002 06:10 AM
07-03-2002 06:10 AM
Re: favourite sysadmin scripts you always keep around....
uname -n > /tmp/stale.log
echo "\n\n" >> /tmp/stale.log
find /dev/vg* -type b -exec /sbin/lvdisplay -v {} \; | grep stale 2>> /tmp/stale.log 1>&2
I then email the stale.log to myself.
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2002 06:55 AM
07-03-2002 06:55 AM
Re: favourite sysadmin scripts you always keep around....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2002 07:19 AM
07-04-2002 07:19 AM
Re: favourite sysadmin scripts you always keep around....
Here is a little one to control the data movement in a directory...
#while true
>do ll
>sleep 2
>done
Goodbye!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2002 06:19 AM
07-05-2002 06:19 AM
Re: favourite sysadmin scripts you always keep around....
here is the one which gets the info about successful/failed or sulogs into a file and send the file in mail every day.
Script name logdetails
----------------------------------------
#!/usr/bin/sh
DIR=
D=`date +%d`
if [ $D -lt 10 ]
then
DATE=`date |awk '{print $2,"",$3}'`
else
DATE=`date |awk '{print $2,$3}'`
fi
last -R | grep "$DATE" > $DIR/goodlog
lastb -R | grep "$DATE" > $DIR/badlog
dt=`date +%m/%d`
cat /var/adm/sulog |grep "$dt" > $DIR/sulog
echo "GOOD LOGS" > $DIR/complog
echo "---------" >> $DIR/complog
sort -k 7,7 $DIR/goodlog >> $DIR/complog
echo >> $DIR/complog
echo "BAD LOGS" >> $DIR/complog
echo "--------" >> $DIR/complog
sort -k 7,7 $DIR/badlog >> $DIR/complog
echo >> $DIR/complog
echo "SU LOGS" >> $DIR/complog
echo "-------" >> $DIR/complog
cat $DIR/sulog >> $DIR/complog
--------------------------------------------
put the follwoing entry in crontab
55 23 * * * /sysadm/cord/shell/logdetails/logdetails.sh;elm -s "Log Details on HPTST" (mail id) < (Your Directory)/complog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2002 06:39 AM
07-05-2002 06:39 AM
Re: favourite sysadmin scripts you always keep around....
i mentioned the path in crontab which is in my system, its a mistake it should be
55 23 * * * (Your Directory)/logdetails;elm -s "Log Details on
which runs everyday at 11:55 pm.
regds
ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2002 06:50 AM
07-05-2002 06:50 AM
Re: favourite sysadmin scripts you always keep around....
one more small script which sends the mail about file systems which are 90% or more full.
Script name: fscron
--------------------------------------------
#!/usr/bin/sh
bdf|awk '{print $5," ",$6}'|sed 's/%/ /g'|awk '$1>89{print $1," ",$2}'|sed '1d'
--------------------------------------------
put the following entry in crontab
55 8 * * * (your Directory)/fscron > (your directory)/fssize;elm -s "FS Size more than 90 on
regds
ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2002 07:22 AM
07-05-2002 07:22 AM
Re: favourite sysadmin scripts you always keep around....
Here's my contribution :
A little script to run every nite late, which send an email in case of any big error in omniback backups..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2002 09:49 AM
07-05-2002 09:49 AM
Re: favourite sysadmin scripts you always keep around....
Rgds...Geoff
cat hpmem
#!/bin/ksh
#
# Taken from the HP/UniGraphics FAQ
# You must be ROOT to execute this since it uses adb to
# examine the running kernel
#
GetKernelSymbol()
{
echo "$1/D" | adb -k $hpux /dev/kmem | tr "\012" " " | read junk junk2 kval
}
hpux=/hp-ux
rev=$(uname -r | cut -d. -f2)
if ((rev > 9)); then hpux=/stand/vmunix ;fi
/bin/uname -a
GetKernelSymbol "processor_count"
print CPU Count: $kval
GetKernelSymbol "itick_per_tick"
let speed=kval/10000
print CPU Speed: $speed MHz
if ((rev > 10)); then
print CPU HW Support: `getconf HW_CPU_SUPP_BITS`-bit
print Kernel Support: `getconf KERNEL_BITS`-bit
GetKernelSymbol "memory_installed_in_machine"
else
GetKernelSymbol "physmem"
fi
let mb=kval*4/1024 # convert pages to MB
print RAM Size: $mb MB
GetKernelSymbol "bufpages"
let mb=kval*4/1024 # convert pages to MB
print bufpages: $mb MB
GetKernelSymbol "maxuprc"
print maxuprc: $kval
GetKernelSymbol "maxvgs"
print maxvgs: $kval
GetKernelSymbol "maxfiles"
print maxfiles: $kval
GetKernelSymbol "max_thread_proc"
print max_thread_proc: $kval
GetKernelSymbol "nfile"
print nfile: $kval
GetKernelSymbol "nflocks"
print nflock: $kval
GetKernelSymbol "nproc"
print nproc: $kval
GetKernelSymbol "ninode"
print ninode: $kval
GetKernelSymbol "vfd_cw"
print shmmax: $kval
GetKernelSymbol "shmmni"
print shmmni: $kval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2002 09:53 AM
07-05-2002 09:53 AM
Re: favourite sysadmin scripts you always keep around....
Rgds...Geoff
>cat /opt/hpnpl/bin/lpst
#!/bin/sh
#
# check printer status
# Geoff Wild
if [ $# -lt 1 -o \( $# -gt 1 -a $# -lt 4 \) ]
then
echo "Usage:"
echo "lpst \"printer\""
echo "Example:"
echo "lpst W052"
exit 1
fi
echo " "
/usr/sbin/ping $1 -n 2
echo " "
lpstat -p$1 -v$1
echo " "
echo "Output Requests"
echo "-----------------------------------------------------------"
lpstat -o$1
echo " "
lpstat -r
echo " "
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2002 12:29 AM
07-06-2002 12:29 AM
Re: favourite sysadmin scripts you always keep around....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2002 10:52 PM
07-07-2002 10:52 PM
Re: favourite sysadmin scripts you always keep around....
I often want to trace and analyse the network traffic from my host to a specific device on the lan.
Using trace_net a.b.c.d will do this
trace_net (
host=$1
echo "Tracing with $host"
rm /tmp/conslog.opts > /dev/null 2>&1
echo "FILTER IP_SADDR $host" >> /tmp/conslog.opts
echo "FILTER IP_DADDR $host" >> /tmp/conslog.opts
nettl -start
nettl -traceoff -e all
nettl -tn pduin pduout -s 1024 -e all | netfmt -c /tmp/conslog.opts -N | grep -v "packet filtered out"
~
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 03:22 AM
07-08-2002 03:22 AM
Re: favourite sysadmin scripts you always keep around....
to identify who is sending large mails and warn them not to block mail queue i use the following script. here it logs all the mail ids, size of mail and date & time if the mail size is more than 1MB. u can keep the same in crontab for every minute to automate.
--------------------------
mailq|awk '$2 > 1048576 {print $2,"\t ",$3,$4,$5,$6,"\t ",$7}' \
|awk '/^[0-9]/{print}' >> /tmp/msizetemp
sort -n /tmp/msizetemp | uniq > /tmp/msize
------------------------------
regds
ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 05:20 AM
07-08-2002 05:20 AM
Re: favourite sysadmin scripts you always keep around....
to warn users about today's database backups every time they login, the following script may be useful.
----------------------------
# Database Backup Warning: Script for generating message
TODAY="`date '+%a'`"
VARFILE=(your file)
SRCDIR= (your Directory)
case $TODAY in
Mon ) cp $SRCDIR/bkup.mon $VARFILE; date '+%d-%b-%Y' >>$VARFILE;;
Tue ) cp $SRCDIR/bkup.tue $VARFILE; date '+%d-%b-%Y' >>$VARFILE;;
Wed ) cp $SRCDIR/bkup.wed $VARFILE; date '+%d-%b-%Y' >>$VARFILE;;
Thu ) cp $SRCDIR/bkup.thu $VARFILE; date '+%d-%b-%Y' >>$VARFILE;;
Fri ) cp $SRCDIR/bkup.fri $VARFILE; date '+%d-%b-%Y' >>$VARFILE;;
Sat ) cp $SRCDIR/bkup.sat $VARFILE; date '+%d-%b-%Y' >>$VARFILE;;
*) > $VARFILE;;
esac
cat $VARFILE
----------------------------------------
add the following in /etc/profile
-------------------------------------
tput smso
sh (script path)
tput rmso
------------------------------------
here bkup.mon, bkup.tue etc should exist in the SRCDIR. an example of such file (bkup.mon)is
***********************************************************************
Cold backup of database(database name) will be taken today at 1915hrs.
The ORACLE database (Database name) will not be available for use from
1915hrs onwards till the backup operation is completed.
Thanks & Regards
SYS. ADMIN. GROUP
***********************************************************************
regds
ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2002 10:45 AM
07-11-2002 10:45 AM
Re: favourite sysadmin scripts you always keep around....
If you have ever had an Ignite and didn't know when the tape was created, without actually restoring the tape. You can issue a couple of commands to read the lif area of a tape and determine when it was created:
verify that the Ignite tape is mounted and rewound:
mt rew (if you are using the default /dev/rmt/0m otherwise mt -t /dev/rmt/1m rew)
then dd off the lif area of the tape to the file /tmp/tapelif:
dd if=/dev/rmt/0m of=/tmp/tapelif bs=2048 count=10
Now list the contents of the file /tmp/tapelif with lifls:
lifls -l /tmp/tapelif
volume ISL10 data size 281239 directory size 3 02/07/05 18:02:25
filename type start size implement created
===============================================================
ISL -12800 16 240 0 02/07/05 18:02:25
AUTO -12289 256 1 0 02/07/05 18:02:25
INDEX BIN 264 1 0 02/07/05 18:02:25
CONFIG BIN 272 35 0 02/07/05 18:02:26
HPUX -12928 312 880 0 02/07/05 18:02:26
INSTALL -12290 1192 26990 0 02/07/05 18:02:33
INSTALLFS -12290 28184 31744 0 02/07/05 18:02:39
FWWKAR BIN 59928 1 0 02/07/05 18:02:39
INSTCMDS BIN 59936 10750 0 02/07/05 18:02:42
SYSCMDS BIN 70688 45488 0 02/07/05 18:02:50
SCRIPTS BIN 116176 42 0 02/07/05 18:02:50
The date is listed as yy/mm/dd so the above tape was created on July 5, 2002 at 6:02PM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2002 01:12 PM
07-11-2002 01:12 PM
Re: favourite sysadmin scripts you always keep around....
A script to collect the Total CPU load on systems, if you want data to plot graphs:
#! /bin/sh
# Authored by Anu Mathew on 01.30.2002
###################################################################
# This script reports the total CPU utilization to the calling
# scripts from up101utl, the performance collector.
###################################################################
i="sys1 sys2 sys3 sys4 sys5 sys6 sys7 sys8 sys9 sys10 sys11"
cpuload=/tmp/cpuload.log
error=/perf/error.log
file=/perf/perf.weekly
for i in $i
do
remsh $i /usr/sbin/sar -M 1 10 2>>$error |egrep Average|egrep "system"
> $cpuload
if [ -s $cpuload ]
then
echo "`echo $i ` `date +%a` `date +%x` `date +%H:%M` `cat $cpuload
|awk '{print $6 "\t" 100-$6}' ` " >> $file
else
: # Do nothing
fi
done
Notes:
Schedule interval and customize per requirements.
Thanks
Anu Mathew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2002 01:45 PM
07-11-2002 01:45 PM
Re: favourite sysadmin scripts you always keep around....
This is particularly useful after a reboot or a maintenance where you want to perform a sanity check if you have quite a number of interfaces.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2002 02:21 AM
07-12-2002 02:21 AM
Re: favourite sysadmin scripts you always keep around....
I use this script to split my Oracle Database Export dump file into 4 pieces each going to a different file system.
Thus overcoming File System size limitations on some systems.
Very helpful to me.
NB. Requires Oracle 8.1.x. I use it on Oracle 8.1.7.4.
Best Regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2002 04:53 AM
07-15-2002 04:53 AM
Re: favourite sysadmin scripts you always keep around....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2002 12:28 PM
07-18-2002 12:28 PM
Re: favourite sysadmin scripts you always keep around....
ebdf - bdf in KB, MB, or GB sorted by filesystem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2002 12:52 PM
07-18-2002 12:52 PM
Re: favourite sysadmin scripts you always keep around....
preloadbal.sh
#!/usr/bin/ksh
#
# @(#) Module: preloadbal.sh Release: 1.2 Date: 07/18/02 Time: 15:37:32
#
# ****
# **** This Script is under Revision Control, do not
# **** modify this script directly without going thru
# **** the revision control system first
# ****
#
# Takes space delimited filesytems as parameters and
# sorts them in numeric order as a precursor to the
# Omniback Load Balancer.
#
typeset -i CNT
if [ $# -ge 1 ]; then
DFFS=$*
else
DFFS=""
fi
CNT=0
df -k $DFFS|
while read LINE; do
if [ "`echo $LINE | cut -c1`" = "/" ]; then
FS=`echo $LINE | cut -f1 -d'('`
TOT=`echo $LINE | cut -f2 -d':' | tr -s ' ' ' ' | cut -f2 -d' '`
let CNT=1
fi
if [ $CNT -eq 2 ]; then
FREE=`echo $LINE | tr -s ' ' ' ' | cut -f1 -d' '`
fi
if [ $CNT -eq 3 ]; then
USED=`echo $LINE | tr -s ' ' ' ' | cut -f1 -d' '`
fi
if [ $CNT -eq 4 ]; then
PCNT="`echo $LINE | tr -s ' ' ' ' | cut -f1 -d' '`%"
let CNT=0
echo "$USED $FS"
fi
let CNT=$CNT+1
done | sort -r -n
The second script is attached and has a command line option of -c for creating the output file. We have a Surestore 6/60 and have 6 LTO drives so you may have to adjust it for the number of drives you have. In a nutshell this script starts w/ the largest filesytem and assigns it to a drive. It then gets the next one and does the same. When all drives have at least 1 filesystem assigned it will then begin to assign each subsequent filesystem to the drive w/ the least amount of data on it until it has all the filesystems done. It then creates a datalist usuable inside of OB as is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2002 12:36 AM
07-19-2002 12:36 AM
Re: favourite sysadmin scripts you always keep around....
Cheers,
Raimo
#!/usr/bin/sh
function disks
{
for i in `ioscan -fnC disk|grep -v floppy|grep rdsk|awk '{print $2}'`
do
diskinfo -b $i
done
}
x=0
for i in `disks`
do
printf "%5.#2f\n" `echo "$i/(1000*1024)"|bc -l `
x=`expr $x + $i`
done
printf "Total disk space %5.2f GB\n" `echo "$x/(1000*1024)"|bc -l`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2002 01:33 AM
07-19-2002 01:33 AM
Re: favourite sysadmin scripts you always keep around....
haven't got time now to have a look at all the favorite scripts posted by all the others in this thread.
So it might be that someone else already posted something similar.
Nevertheless, just a couple of days ago I had to check and possibly set the timeout values of many hundred disks from various of our disk storage subsystems according to different vendor specifications (e.g. EMC calls for 180 secs whereas HITACHI needs 60 secs).
Obviously such repetitive mundane works calls for a script.
So just throwing together a couple of LVM commands in a short time the scriplet you may find attached was made, and in a flick all PVs were set correctly.
Hope this will be of any use to your collection.
Ralph
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2002 07:20 AM
07-19-2002 07:20 AM
Re: favourite sysadmin scripts you always keep around....
Hope it helps
John