Operating System - HP-UX
1833184 Members
2903 Online
110051 Solutions
New Discussion

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

 
SOLVED
Go to solution
Khalid A. Al-Tayaran
Valued Contributor

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


Hi,

type ls /dir/* and you'll get a listing of each directory and its sub-directories and files.

Example:
ls /usr/*

/usr/tmp:
OBAMHBAa01106 OBAMPAAa06934 envd.action5 ntp
OBAMIBAa03540 ems_inittab.old ign_configure swagent.log
OBAMNAAa01171 envd.action2 inetd.conf.old vol.tmp

/usr/tsm:
.tsm .tsmprint bin src term
.tsmkeys HPVERSION facetpcbin sys text

/usr/vue:
app-defaults bin
Ricky B. Nino
Frequent Advisor

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

a script that will kill specified user except for some like 'root'.

see attached.
Opportunities expand for people willing to put time and effort into learning new skills.
Stanimir
Trusted Contributor

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

Hi!
Has anybody a blondie-operators around your
work environment?
There are 2 of them here. :)
They are working with our system printers lp1_1 & lp2_1. So Difficult!!! And so many commands here about spooler and printers.
So here are an interface for using printers & control jobs for them. $LOCALDIR may be various.
Regards...

Stanimir
Trusted Contributor

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

Hi,Bill!
Another script ...
Script is part of /etc/profile - managing of user-sessions - it remove old sessions , allow only 1 user session,
assign priorities for each user /the user-priority is written beforehand in field 5 in every row of /etc/passwd /
Some users are the exceptions, indeed....
Regards.
Stanimir
Trusted Contributor

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

This is only addition to my first *.tar:
Cleared from problems and tested version.
Ricardo Bassoi
Regular Advisor

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


Hi,

Here follows a script that check the file systems. If the limit value is reached so a email is sent to the Administrator.

Regards,

Ricardo Bassoi
If you never try, never will work
Ricardo Bassoi
Regular Advisor

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


Sorry All,

I sent a zip file in the attach.
Here follows the text.

Regards,


Ricardo
If you never try, never will work
Bill McNAMARA_1
Honored Contributor

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

defrag, reduce fs and lv
stupid script, but useful if you're new to filesystem reduction or have a lot of filesystems to reduce, or hate doing KB to MB conversions.

PS: this script was thrown together real quick - it only does minimal testing.
Use at own risk.
It works for me (tm)
Bill McNAMARA_1
Honored Contributor

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

extendlv and fs (you must have onlineJFS btw.)
same rules apply as the above..
It works for me (tm)
Bill McNAMARA_1
Honored Contributor

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

reducefslv updated..
It works for me (tm)
Ian Dennison_1
Honored Contributor

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

This script wot I wrote,...

Due to budget constraints, we have no XP512 Business Copy to use for refreshing environments. I have written a quick restore script that allows the User to define a 'rehosting' by using OmniBack Backups.

By providing the DBAs this script, they can perform their own restores without requiring OmniBack access, and the script allows a 'configure once-run many' philosophy.

The restore can be set to specify the logical volumes (or specific files within the logical volumes) to be specified, the source and destination servers and alterations to the path (changing the Oracle SID only).

The user then selects the specification to use, the session to restore from, and the tape drives to use.

This has saved heaps of time that was spent creating restores 1 mount point at a time, selecting versions, destination servers and 'restore as' directories.

Included are the script, the User instructions and SysAdmin customising instructions.

Any suggestions for improvement, my email address is at the end of the SysAdmin Notes.

Share and Enjoy! Ian

PS. HP - how about this functionality in OmniBack 5?
Building a dumber user
ITeam
Super Advisor

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

Here's a script we have been using for a long time.
It gets the size of directories and the sub-directories and displays in kb. The usage is "dutree ".

Many thanks.
RAJESH GANGADHARAN
Regular Advisor

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

Hi

Here is a simple script which will give a snap shot of LVM informations like VG name PVs in a vg, LV name, size, mount point, fs type etc.

This script will give a warning if any lvol doesn't have an entry in /etc/fstab file.
Let the choices you make today be the choices you can live with tomorrow.
David_246
Trusted Contributor

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

Hi,

A nice script to find out the total memory claimed by the system.

Regs David
@yourservice
Sanjiv Sharma_1
Honored Contributor

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

Hi,

This is a script for the filesystem utilization check and the root mirror status check.

Incase the threshold is crossed. It sends and alert to me. Also if the root mirror fails it send an alert.

It has been scheduled to run once a day.

Name of the script: fs_check.txt
Everything is possible
Dave La Mar
Honored Contributor

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

Attached is a collection of scripts that work together.
Purpose:
Gather systems stats on cpu utilization and memory using glance.
Get the average cpu consuption for the reporting period.
Get the low point of memory for the reporting period.
Send a month to date recap in html format via email to interested parties every Friday.
Some of the scripts are a bit rough since they were written in the heat of need. But all are in production and have been running for months.

Regards,
dl
"I'm not dumb. I just have a command of thoroughly useless information."
James Odak
Valued Contributor

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

script i run to check all servers each day

serverlist is a list of all servers
path and attached_script_name refer to the script i attached

###

for i in `cat /serverlist`
do

banner $i

rcp /path/attached_script_name $i:/tmp

remsh $i /tmp/attached_script_name

remsh $i "/usr/bin/rm /tmp/attached_script_name"



done
James Odak
Valued Contributor

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

sorry reformatted attachment
Chris Vail
Honored Contributor

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

I'm attaching a series of Netbackup scripts that I've written over the last year or so. The first of these is "dailysize", which calculates the amount of data backed up by either class or client on a given day.
Chris Vail
Honored Contributor

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

This is the 2nd of several Netbackup scripts. These are all thoroughly tested and in production. This is the dateexpire script, which takes all tapes in a given pool (Netbackup pool is default) and expires them so they can be re-used.
Chris Vail
Honored Contributor

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

I hope the dateexpire script came through. The submit button gave back a 404 error.

Nevertheless, here's the next Netbackup script. This one is called tapeusage, and is one of the handi-dandier scripts I've written. It shows the number of tapes and the amount of data backed up for the last several days, the default is 7.
Chris Vail
Honored Contributor

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

Everyday, the /var/adm/syslog/syslog.log file fills up with a lot of uninteresting information. But sometimes, exceptions occur and they're very interesting. I've attached a .doc file (yes folks, REAL DOCUMENTATION--you saw it here first) on a script that eliminates redudant/uninteresting data from a day's entries in the syslog.log file, and mails the rest to interested parties. The script can be extracted from the document by eliminating the line numbers. We look for hacking attempts, out of space conditions, and other errors with this script.
Chris Vail
Honored Contributor

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

This next is too short to send as an attachment. This is under my 'quick and dirty' shell script collection.
When looking at /var/adm/syslog, disk errors are identified by a hex code number. This script, called "scsi_decoder" converts that hex number into a cXtXdX format, so you know which controller, target and disk is being referenced.

./scsi_decoder a12b3c44
This translates to c43t3d12

Here's the script:
#!/bin/ksh
Z=$1
I=`echo $Z|tr '[a-z]' '[A-Z]'`
LENGTH_I=`echo $I|wc -m`
if test "$LENGTH_I" -eq 9
then
A=`echo $I|sed s/..//`
B=`echo $A|sed s/....$//`
C=`echo "ibase=16;$B"|bc`

R=`echo $I|sed s/....//`
S=`echo $R|sed s/...$//`
T=`echo "ibase=16;$S"|bc`

F=`echo $I|sed s/.....//`
G=`echo $F|sed s/..$//`
D=`echo "ibase=16;$G"|bc`

echo "This translates to c"$C"t"$T"d"$D" "
echo

else
echo "The input string must be exactly 8 bytes. "
fi
Chris Vail
Honored Contributor

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

Okay, this will be the last of my Netbackup scripts for the moment. This is another useful one. I have it set in cron to run every day at 4 PM to email me and tell me how many tapes are in which Netbackup pool. This lets me check pool sizes before going home at the end of the day.
Kevin Tuitt
Occasional Advisor

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

sorry, my first post (newbie) sent as a new message instead of a reply..

A pretty robust script for killing users. It takes multiple arguments e.g. kiluser user1 user2 user3

It checks usernames, provides options for killing all or a single user processes, checks the processes are owned by the user in question, provides customisable exclusion list (includes root already) blah de blah de blah. I've also got a kiltty (takes the tty as an argument) and a kilgrep (takes any string you give it; VERY dangerous) but I'm working on giving these the all, one or none options before submitting.
When you are right, no-one remembers; When you are wrong, no-one forgets.