Operating System - HP-UX
1751802 Members
4988 Online
108781 Solutions
New Discussion юеВ

favorite sysadmin scripts you always keep around (3)

 
SOLVED
Go to solution
John Meissner
Esteemed Contributor

Re: favorite sysadmin scripts you always keep around (3)

Here is a script that will let you open a terminal window on someone's workstation and post a messgage to it. I've found this to be useful at times.
All paths lead to destiny
John Meissner
Esteemed Contributor

Re: favorite sysadmin scripts you always keep around (3)

This script can be used as a splash screen at the beginning of a script. It contains 2 files. the script and a wxd image file. I won't go into how to create the image file but I'm tar/gzip'ing the script and an image file (as an example)
All paths lead to destiny
Sajith V Mannadiar
Frequent Advisor

Re: favorite sysadmin scripts you always keep around (3)

Here is a very handy script to create all the mount points required for the filesystems listed in fstab...

The script -> create_mnts
-----------

#!/bin/ksh
cd /
echo "Creating the required mount points..."
cat /etc/checklist |grep -v "^#"|awk '{print $2}'| while read dir_name
do
if [ ! -d ${dir_name:="/etc"} ]
then
umask 022;mkdir -p $dir_name
echo "Directory $dir_name created..."
fi
done
echo "Creating the required symbolic links..."
cat /etc/checklist |grep "symbolic link" | while read link_entry
do
sdir=`echo $link_entry|cut -d" " -f2`
ddir=`echo $link_entry|cut -d" " -f3`
ddir1=`dirname $ddir`
ddir2=`basename $ddir`
umask_val=`echo $link_entry|cut -d" " -f8`
umask $umask_val
mkdir -p $ddir1
cd $ddir1
ln -s $sdir $ddir2
echo "Created link $ddir -> $sdir "
umask 022
done

---------------------------------------

Sample fstab attached
--------------------


In our lab, at times, the systtem load increases due to some runaway processes...

Here is a one-liner to catch hold of them.. I call it 'runproc'

#!/bin/ksh

ps -elf|grep " R "|grep -v -E 'grep|ps'


-----------------
John Meissner
Esteemed Contributor

Re: favorite sysadmin scripts you always keep around (3)

this script will report the number of CPS's and their speeds.
All paths lead to destiny
Dave La Mar
Honored Contributor

Re: favorite sysadmin scripts you always keep around (3)

Attached is a script written because we got tired of mailing out files for the HP CE Tech.
When invoked, the CE can attach a number of files and send to a number of email addresses.
The call to MOTD has a privacy message for our protection, so you can be calling your own or comment this out.
The $MAILX_FILE is an executable that simply performs the mailx command and send out the attachments.

Have fun.

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Charles Harris
Super Advisor

Re: favorite sysadmin scripts you always keep around (3)

Hi, here's my totaly pointless script to add that Matrix feel to anything you like:-

#!/usr/bin/sh
# scroll
# Don't ask.

typeset -i x=0
strg_len=`echo "$*" | wc -m`
#clear

delay ()
{
base=0
time=$1
while (( time > base ))
do
(( time = time - 1 ))
delays[x]="Delay?"
done
unset delays[*]
}

while (( x < $strg_len )) && (( $strg_len < 1024 ))
do
(( x = x + 1 ))
scroll[x]=`echo "$*" |cut -c $x`
[ ${scroll[x]} ] 2> /dev/null && {
print "${scroll[x]}\c"
delay 2000
} || {
print "${scroll[x]}\c"
delay 5000
}
done
tput cud1

Good for a laugh!

-ChaZ-


Steven E. Protter
Exalted Contributor

Re: favorite sysadmin scripts you always keep around (3)

Its been a while since I contribued here.

I have a few more.

check_rootlogin

It reports on bad root login attempts. I use it in cron. It can be set to auto disable the id, but I didn't think that was a very good idea.

SEP

Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven E. Protter
Exalted Contributor

Re: favorite sysadmin scripts you always keep around (3)

dailydisk.sh

Provides sysadmin with a list of new large files created in size order.

This is a production script.

BTW, I did check my back posts for dups.

SEP

Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
John Meissner
Esteemed Contributor

Re: favorite sysadmin scripts you always keep around (3)

I just finished, and tested successfully, this script. I've been using make_sys_image for a while writting to tape. I wanted to write create an ISO image instead. This script will create a bootable DVD image that you can use a DVD burner to write the image with. You will need CDRW software installed on your HP-UX machine (it's usually installed here:

/opt/OpenSource/xcdroast-0.98

You may need to edit some of the paths in the script for your own use - but on my system it works very well.
All paths lead to destiny
Karthik S S
Honored Contributor

Re: favorite sysadmin scripts you always keep around (3)

Lots of great scripts are available at,

( Unix Power Tools, 2nd Edition: Examples )

ftp://ftp.oreilly.com/published/oreilly/power_tools/unix/upt9707.tgz

Regards,
Karthik
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn