- 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
02-15-2002 12:41 AM
02-15-2002 12:41 AM
top points awarded for TRIED and TESTED scripts!
swcopy:
=======
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x9a6150011d20d6118ff40090279cd0f9,00.html
bdf in MB:
==========
from the forums.. attached
nickel:
=======
html collect system info
http://www.grc.hp.com/docs/nickel/
Later,
Bill
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 12:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 01:10 AM
02-15-2002 01:10 AM
Re: favourite sysadmin scripts you always keep around....
one of the favourite sysadmin scripts should be a cleanup script for /tmp /var/tmp and other (application) temporary directories. As this is server/site specific it's hard to give a standard script.
Another important one is the cfg2html script, which gives you far more information about your server than you ever going to need ;-) (hopefully)
http://members.tripod.com/rose_swe/cfg/cfg.html
regards,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 01:13 AM
02-15-2002 01:13 AM
Re: favourite sysadmin scripts you always keep around....
Hi,
Good examples of script available here.
http://www.introcomp.co.uk/examples/index.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 01:18 AM
02-15-2002 01:18 AM
Re: favourite sysadmin scripts you always keep around....
My pfsmcd script, many years back. pfsmcd starts the pfs daemons if they have not been started, detects if a CD is already mounted and pfs-mounts the CD (Oracle CD) if it has not been mounted or pfs-unmounts the CD if it has already been mounted.
In addition to root.sh, I had this script added to restricted sam so that the DBA won't come and bother me to mount and unmount Oracle CDs everytime.
Hope this helps. Regards.
Steven Sim Kok Leong
#!/usr/bin/ksh
if ps -ae|grep -v grep|grep pfs_mountd > /dev/null 2>/dev/null
then
echo pfs_mountd already started
else
echo Starting pfs_mountd
nohup /usr/sbin/pfs_mountd &
sleep 5
fi
if ps -ae|grep -v grep|grep pfsd > /dev/null 2>/dev/null
then
echo pfsd already started
else
echo Starting pfsd
nohup /usr/sbin/pfsd &
sleep 5
fi
if /sbin/mount|grep /cdrom > /dev/null 2>/dev/null
then
echo Unmounting /cdrom
pfs_umount /cdrom > /dev/null 2>/dev/null
else
echo Mounting /cdrom
pfs_mount /cdrom > /dev/null 2>/dev/null
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 03:48 AM
02-15-2002 03:48 AM
Re: favourite sysadmin scripts you always keep around....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 04:11 AM
02-15-2002 04:11 AM
Re: favourite sysadmin scripts you always keep around....
not a shell script, but a complete reference to UNIX:
http://w3.softlookup.com/unix
I am pretty sure you're gonna like chapter 15 Bill :-)
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 04:16 AM
02-15-2002 04:16 AM
Re: favourite sysadmin scripts you always keep around....
sorry for that link. Came accross it via search engine, and it worked fine, but if you call the link directly, you get a whole lot of commercial popups.
Sorry for that, did not intend to.....
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 04:17 AM
02-15-2002 04:17 AM
Re: favourite sysadmin scripts you always keep around....
I'm going to have to speak to my boss about that!
15 - Awk, Awk
oh my God ;)
Later,
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 04:18 AM
02-15-2002 04:18 AM
Re: favourite sysadmin scripts you always keep around....
Some time ago, i have done the effort to modify the script a very little and to correct the layout issues. For anyone who is interested : feel free to use and enhance it further :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 06:01 AM
02-15-2002 06:01 AM
Re: favourite sysadmin scripts you always keep around....
#!/bin/sh
if test `TZ=MET-24 date +%d` = 01
then
exec command
else
exit 1
fi
C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 06:06 AM
02-15-2002 06:06 AM
Re: favourite sysadmin scripts you always keep around....
Produces a map of the lvol locations in vg00
HTH
Duncan
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 06:11 AM
02-15-2002 06:11 AM
Re: favourite sysadmin scripts you always keep around....
It gets rid of those nasty users who just won't log off when you ask them to in order to do maintenance. It does keep a few users that you don't accidently want to get rid of.
Tracey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 06:15 AM
02-15-2002 06:15 AM
Re: favourite sysadmin scripts you always keep around....
The exception list is just a file with contents like:
root
oracle
tracey
Tracey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 06:17 AM
02-15-2002 06:17 AM
Re: favourite sysadmin scripts you always keep around....
A small script to ensure that tapes are never missed.
I have it cronned to run on all servers at 16:00 hrs every day.
Change the Email address to suit
-----------------cut here----------------
#!/bin/sh
#############################################
# Check for tape in drive
# PJFC 2002
#############################################
# Check if tape is in Drive (set for correct dev file)
if /usr/bin/mt -t /dev/rmt/0m rew 2>/dev/null ; then
#############################################
echo "----------------------------" >>/tmp/tape-log
date >> /tmp/tape-log
echo "------ Tape in ------" >>/tmp/tape-log
else
#############################################
# Inform if no tape in drive
echo "----------------------------" >>/tmp/tape-log
date >> /tmp/tape-log
echo "------ TAPE NOT LOADED -----" >>/tmp/tape-log
mailx -s "Tape not mounted on N0" paula@avro.co.uk mailx -s "Tape not in on N0" helpdesk@avro.co.uk exit
fi
-----------------cut here----------------
The /tmp/tape-log keeps historical data and the /sysadmin/team just contains the words "Unix Support Team".
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 06:46 AM
02-15-2002 06:46 AM
Re: favourite sysadmin scripts you always keep around....
Here is the SysInfo script.
Thanks.
Prashant Deshpande.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 07:16 AM
02-15-2002 07:16 AM
Re: favourite sysadmin scripts you always keep around....
Here is a script for sending mail, with message body and attachment.
HTH,
Shiju
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 07:23 AM
02-15-2002 07:23 AM
Re: favourite sysadmin scripts you always keep around....
Here is one to find the clock speed of the system.
./mhz
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 08:18 AM
02-15-2002 08:18 AM
Re: favourite sysadmin scripts you always keep around....
RD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 08:20 AM
02-15-2002 08:20 AM
Re: favourite sysadmin scripts you always keep around....
# cat run
#!/bin/ksh
##############################################################################
#
# THIS SCRIPT RUNS COMMANDS ON REMOTE SERVERS. IT EXPECTS TWO
# COMMAND LINE PARAMETERS:
# $1 SPECIFIES THE EXTENSION OF THE FILE CONTAINING SERVER
NAMES
# $2 CONTAINS THE COMMAND STRING TO RUN ON THE REMOTE SERV
ERS.
#
# CREATED 04/05/00 Alan Riggs
#
##############################################################################
##############################################################################
# ESTABLISH ENVIRONMENTAL VARIABLES
##############################################################################
FILE_BASE=/home/admin/server
EXTENSION=$1
COMMAND=$2
##############################################################################
# USAGE STATEMENT: CHECK FOR EXACTLY TWO COMMAND LINE PARAMETERS
##############################################################################
if [ "$#" -ne 2 ]
then
echo "
usage: run [file extension] [command string]\n
run will execute the command string on one or more remote servers.
The script expects a list of servers in $FILE_BASE.[file extension]
Remember to quote command strings of more than one line.\n "
exit 1
fi
##############################################################################
# RUN THE COMMAND ON THE REMOTE SERVERS
##############################################################################
while read SERVER
do
echo "$SERVER"
remsh $SERVER -n "$COMMAND"
done < "$FILE_BASE"."$EXTENSION"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 08:35 AM
02-15-2002 08:35 AM
Re: favourite sysadmin scripts you always keep around....
# cat find_free_disks.sh
#!/bin/ksh
##############################################################################
#
# THIS SCRIPT FINDS DISKS WHICH NOT PRESENTLY BELONG TO A VOLUME GROUP
#
# CREATED 10/29/99 Alan Riggs
#
##########################################################
set -A DISKS `ls /dev/dsk`
echo "BLOCK SPECIAL FILE\tSIZE\tTYPE"
echo "==================\t====\t===="
for DISK in ${DISKS[*]}
do
pvdisplay /dev/dsk/$DISK >/dev/null 2>&1
if [ $? = 1 ]
then
SIZE=`diskinfo /dev/rdsk/$DISK|grep size|awk '{print $2}'`
TYPE=`diskinfo /dev/rdsk/$DISK|grep type|awk '{print $2 $3}'`
echo "/dev/dsk/$DISK \t$SIZE\t$TYPE"
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 08:35 AM
02-15-2002 08:35 AM
Re: favourite sysadmin scripts you always keep around....
My contribution has to be my universal date engine, 'caljd.sh'. It converts a calendar date (or todays's date) to a true (well, almost) Julian day and also does the reverse. It then becomes trivially simple to calculate the number of days between any two dates.
Examples:
# What is the date in MM DD YYYY format 100 days from now?
DATE=$(caljd.sh $(caljd.sh -n 100))
echo "New Date = ${DATE}"
# What is the date in MM DD YYYY format 100 days from now unless that falls on a weekend?
DATE=$(caljd.sh $(caljd.sh -n 100 -x 0 -x 6))
echo "New Date = ${DATE}"
# What is the date in MM DD YYYY format 100 days from now unless that falls on a weekend?
DATE=$(caljd.sh $(caljd.sh -n 100 -x 0 -x 6))
echo "New Date = ${DATE}"
# What is the date in YYYY-MM-DD format 20 days previous unless that fell on a Friday?
DATE=$(caljd.sh -S '-' -y $(caljd.sh -p 20 -x 5))
echo "New Date = ${DATE}"
caljd.sh -u gives full usage.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 09:31 AM
02-15-2002 09:31 AM
Re: favourite sysadmin scripts you always keep around....
*NOTE* : Script must be edited for local use!
***********************************************
#!/usr/bin/sh
COMMAND="/$DIR1/$Stat_Like_Command"
LOG_DIR="/$DIR2"
$COMMAND > $LOG_DIR/$COMMAND.current
if [ -e $LOG_DIR/$COMMAND.current ]
then
/usr/bin/diff $LOG_DIR/$COMMAND.current $LOG_DIR/$COMMAND.normal > $LOG_DIR/$COMMAND.diff
if [ -s $LOG_DIR/$COMMAND.diff ]
then
echo "Possible Issue with $COMMAND" | mailx -S $COMMAND your@pager.email.com
cat $LOG_DIR/$COMMAND.diff
else
echo "$COMMAND is OK"
fi
else
echo "$COMMAND could not execute"
fi
***********************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 11:06 AM
02-15-2002 11:06 AM
Re: favourite sysadmin scripts you always keep around....
# pg extract
#!/bin/ksh
# 10/08/01
# mark greene
# sed -n 'StartLineNumber,EndingLineNumber' source_file > target_file
# $1=source file, $2=starting line, $3=ending line, $4=target file
if [ $# -lt 4 ]; then
echo "usage: extract source starting_line ending_line target"
exit
fi
SOURCE=$1
START_PAGE=$2
END_PAGE=$3p
TARGET=$4
QUOTE="'"
CMD="-n $QUOTE$START_PAGE,$END_PAGE$QUOTE"
eval "sed $CMD $SOURCE >$TARGET"
exit $?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2002 11:14 AM
02-15-2002 11:14 AM
Re: favourite sysadmin scripts you always keep around....
Here is another one i had downloaded from somewhere, but don't use. thought someone might find it useful.
Regards
sanjay