Operating System - HP-UX
1833057 Members
2539 Online
110049 Solutions
New Discussion

favorite sysadmin scripts you always keep around [2]

 
SOLVED
Go to solution
Mark Landin
Valued Contributor

Re: favorite sysadmin scripts you always keep around [2]

My HP-UX systems aren't directly connected to the Internet, so I don't have a good way to pull down patches resulting from a session with Custom Patch Manager. I wrote this Perl script to turn the package_info file into a script that could be fed to any standard FTP client on another machine that CAN get to the Internet.

Mark Landin
Valued Contributor

Re: favorite sysadmin scripts you always keep around [2]

OK here's another. It's a makefile and script I use to maintain my sendmail aliases.

I keep two text files: users.txt and groups.txt. The Makefile turns these two lists into both a sendmail alias list and a userdb DBM file that sendmail also uses. Then it pushes those files out to all the mail hubs in the network.

OK looks like just one attachment, so I'll post the Makefile directly here:


SRCS=users.txt groups.txt
DB=userdb.txt

install: aliases userdb.db
./push_alias

aliases: ${SRCS}
mv $@ $@.old
sed "s/:/:mailname/" users.txt > ${DB}
cat ${SRCS} >> $@
chmod 644 $@

userdb.db: ${DB}
mv $@ $@.old
/usr/sbin/makemap btree $@ < ${DB}




Mark Landin
Valued Contributor

Re: favorite sysadmin scripts you always keep around [2]

Guess I should explain the formats of these files!

Sample users.txt:

user1: user@realmail.net
user2: user2@realmail.net
user3: user3@othermail.com


groups.txt:
all_users: user1, user2, user3
Ron D.
Frequent Advisor

Re: favorite sysadmin scripts you always keep around [2]

Here's a script that uses sar to grab % disk utilization and average disk queue length. The output is formatted for MRTG so that it can be graphed. I use rsh to call it from the MRTG system but I'm sure it could be done more securely.

You will have to modify the awk command to properly identify the disk ID to be monitored and the systemID (both between "<" and ">".

Cheers
Mike Jones_2
New Member

Re: favorite sysadmin scripts you always keep around [2]

Here are a some functions I have defined in my .kshrc script and use quite often.

psg : searches for process that contains the search string (similar to psg script listed earlier in this thread).
Usage : psg search_string

qstat : lists the status of a single print queue along with the status of any print jobs
Usage : qstat queue_name

ugsessions : Checks FlexLM license server and tells me how many users are running UG as well as when the each session started. Session are sorted by workstation name. Remove the "-k2,2" from the sort command to sort by user ID. This should work with any package using FlexLM licensing since the function uses the "lmutil lmstat" command (I've tested it with UG, Patran, Abaqus, & Vericut).
Usage : ugsessions
Radhakrishnan Venkatara
Trusted Contributor

Re: favorite sysadmin scripts you always keep around [2]

hi,

this script gets some good details of the server like cpu binary, CPU Model, No. of cpus, Memory , etc.



radhakrishnan
Negative thinking is a highest form of Intelligence
Geoff Wild
Honored Contributor

Re: favorite sysadmin scripts you always keep around [2]

This one is small - but retrieves some information on your sendmail - including the version.

Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: favorite sysadmin scripts you always keep around [2]

This one (vgttl) gives a nice summary of allocated, used, available disk space of your volume groups. Makes use of the bdfmegs script.

Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Jack C. Mahaffey
Super Advisor

Re: favorite sysadmin scripts you always keep around [2]

Here's a copy 'getchmod' that I referenced in a previous post. It returns the 4 digit chmod value for a file.


Nesan
Advisor

Re: favorite sysadmin scripts you always keep around [2]

Here is a simple script which I uses to automate kernel backup.

Please change location of wherever needed.

This script was useful when we wanted to automate kernel backup and email result on completion. And we have put this script in cron.

In this script, it emails to backup_notif which is aliases for sys admins and backup operators.

Everything you don't know is an opportunity to learn
Gary L. Paveza, Jr.
Trusted Contributor

Re: favorite sysadmin scripts you always keep around [2]

Perl script I wrote to email when certain thresholds are exceeded in filesystem usage. Put it in cron.

Ramkumar Devanathan
Honored Contributor

Re: favorite sysadmin scripts you always keep around [2]

This telnet alias works somewhat like kim's script but is shorter. Add into .profile.

telnet &

don't forget to background the telnet call bcos you are calling the alias.

- ramd.
HPE Software Rocks!
Randy Tarrier
Advisor

Re: favorite sysadmin scripts you always keep around [2]

HI,
Attached are utilities for a DLT40 autochanger, using mc and mt cmds to move tapes between drives, slots, mailslot, etc.
TAPELIB_MOVE - basic movement of cartridges
TAPELIB_1ST_SLOT - find first full/empty slot in range setup by user
TAPELIB_NEXT_SLOT - find next full/empty slot in range setup by user
TAPELIB_SLOT_ROTATE - advance cartridges forward to next empty slot; e.g., slot 2 to 1, 3 to 2, etc. - in range specified by user.
Do it as long as you love it!
Randy Tarrier
Advisor

Re: favorite sysadmin scripts you always keep around [2]

I use this to create a bus copy of an oracle db on the fly-
It requires source & target LUNS, plus mapfile. Here are contents of mapfile:
# cat /etc/lvmconf/vgora_bc.mapfile
1 lvoracopy
2 lvoraficopy
#
It creates device files, vgimport, link to PV's, mounts fs
Do it as long as you love it!
Ted Estes
New Member

Re: favorite sysadmin scripts you always keep around [2]

Bill,

This script I use to get lan interface info. It can be improved by adding speed and duplex queries. It shows device names including virtual lans, ip address, LLA(MAC) address in octet colon notation and primary hostname as found in /etc/hosts.

It has been tested on hp9000/700-800 servers running hpux 10.20, 11.00 and 11.11

Enjoy,
-Ted
Robin T. Slotten
Trusted Contributor

Re: favorite sysadmin scripts you always keep around [2]

Here is a script to sumarize all the Logical Volumes on a system. I was not the original author, but made some enhancements to add options. Great for finding unallocated space.
IF you do it more than twice, write a script.
Klaus Crusius
Trusted Contributor

Re: favorite sysadmin scripts you always keep around [2]

scripts translating system error number to symbolic constant and the other way round.
usage: terr ENOENT
There is a live before death!
Ramkumar Devanathan
Honored Contributor

Re: favorite sysadmin scripts you always keep around [2]

hi Bill,

script to find total no. of files opened by each currently running process and gives out a sorted list thereof.

- ramd.
HPE Software Rocks!
Bill McNAMARA_1
Honored Contributor

Re: favorite sysadmin scripts you always keep around [2]

==========
=
= NOTICE:
=
===========

seeing as this thread is getting large,

please post any scripts to the continuation of this thread:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf0fc5dc05a7ad711abdc0090277a778c,00.html

THANK YOU!
Bill
It works for me (tm)
Sachin Patel
Honored Contributor

Re: favorite sysadmin scripts you always keep around [2]

Hi Donny,

I have one for it.

Note:
1.you must make sure first in your sitting server (from where you run this script) that you do not have "/" or "\" and "$" character in your pssword field.
2. you must be able to ro remsh as a root to all your 100 server.

3. change password in sitting server and run the script.

Big Note: don't try to run it on all your server without testing or else you will not be able to login to any server.

Sachin
Is photography a hobby or another way to spend $
Sachin Patel
Honored Contributor

Re: favorite sysadmin scripts you always keep around [2]

Hi
I forget to mention that after I had a trouble initially I have put option that will allow you to see change password entry. If you think it is not right you can always skip update on that particular system and keep going.

Sachin
Is photography a hobby or another way to spend $
Bill McNAMARA_1
Honored Contributor

Re: favorite sysadmin scripts you always keep around [2]

==========
=
= NOTICE:
=
===========

seeing as this thread is getting large,

please post any scripts to the continuation of this thread:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf0fc5dc05a7ad711abdc0090277a778c,00.html

THANK YOU!
Bill

No points will be awarded here soon!
only here:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf0fc5dc05a7ad711abdc0090277a778c,00.html

It works for me (tm)
Jdamian
Respected Contributor

Re: favorite sysadmin scripts you always keep around [2]

This script lists the physical volumes of a given Volume Group.

Alternate paths are displayed in a only line:

/dev/vg_oracle /dev/dsk/c30t0d5 /dev/dsk/c27t0d5
/dev/vg_oracle /dev/dsk/c27t1d5 /dev/dsk/c30t1d5

/dev/vg00 /dev/dsk/c1t2d0
/dev/vg00 /dev/dsk/c2t2d0
Bill McNAMARA_1
Honored Contributor

Re: favorite sysadmin scripts you always keep around [2]

==========
=
= NOTICE:
=
===========

seeing as this thread is getting large,

please post any scripts to the continuation of this thread:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf0fc5dc05a7ad711abdc0090277a778c,00.html

THANK YOU!
Bill

No points will be awarded here soon!
only here:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf0fc5dc05a7ad711abdc0090277a778c,00.html

==========
=
= EOF!
=
===========
It works for me (tm)
Jack C. Mahaffey
Super Advisor

Re: favorite sysadmin scripts you always keep around [2]

There's been numerous times I've wanted to know which corresponding chmod command was needed to securing files and directories. Here's a script that I've created awhile back that others may want to have. Very useful for determining the chmod integer combinations. It lists the 4 digit code, security string, object type, owner:group, and filename. It has saved my rear-end multiple times and I call it from other scripts for when I may need to reset the security properties for a file or directory.

Here's an example of running the script...
# getchmod /etc/inetd.conf
0644 -rw-r--r-- file root:sys /etc/inetd.conf

And yes, it will use wildcards...

I've named the script getchmod....

jack...