- 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
06-13-2002 09:14 AM
06-13-2002 09:14 AM
Re: favourite sysadmin scripts you always keep around....
Used regularly on 11.0
This is a menu script for removing UserIDs.
It prevents the removal of system IDs and any IDs that have BatchID in its description. It also verifies that the ID has "home" in it's home directory.
The script shows the date all of the ID's home directory files were last accessed ( to ensure that a script that runs isn't using it etc...).
The script then tars the directory into /sysadm/old.ids/ for a quick restore if needed.
The script will need to be reviewed for appropriate directories etc...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2002 08:44 PM
06-13-2002 08:44 PM
Re: favourite sysadmin scripts you always keep around....
another good one.
Sending files by batch to several server using ftp. We use it everyday.
batchftp
best regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2002 09:01 PM
06-13-2002 09:01 PM
Re: favourite sysadmin scripts you always keep around....
This one i got from HP.
Helps me document my server configuration. Generates a report as below:
-----------------------------------------------
cstm>selclass qualifier cpu;info;wait;infolog
-- Information Tool Log for CPU on path 160 --
Log creation time: Fri Jun 14 09:01:12 2002
Hardware path: 160
Product ID: CPU Module Type: 0
Hardware Model: 0x5c9 Software Model: 0x4
Hardware Revision: 0 Software Revision: 0
Hardware ID: 0 Software ID: 541706567
Boot ID: 0x2 Software Option: 0x91
Hard Physical Address: 0xfffa0000 Soft Physical Address: 0
Slot Number: 8 Software Capability: 0x100000f0
PDC Firmware Revision: 40.19 IODC Revision: 0
Instruction Cache [Kbyte]: 512 Processor Speed: N/A
Data Cache [Kbyte]: 1024 Processor State: N/A
Instruction TLB [entry]: 160 Processor Chip Revisions: 2.4
Data TLB Size [entry]: 160 2nd Level Cache Size:[KB] N/A
Serial Number: 0
-------------- Memory Error Log Information --------------
Bus 0 Log Information
No errors logged for this bus
------------ I/O Module Error Log Information ------------
No I/O module errors logged
WARNING: The non-destructive test bit was set, so memory was not tested
destructively. Information only, no action required.
WARNING: One or more DIMMs in the system were not made by HP.
Module Revision
------ --------
System Board A43938
PA 8500 CPU Module 2.4
-----------------------------------------------
Nice script.
Best Regards
Yogeeraj
PS. oops! you will need stm installed on your machine. ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2002 01:03 AM
06-14-2002 01:03 AM
Re: favourite sysadmin scripts you always keep around....
1. px
A perl script that uses the portable Proc::ProcessTable module (also works on AIX and such), accepting ps options and patterns, showing the most interesting columns (IMHO)
2. px-ps
Similar to px, but predates the Proc::ProcessTable module and uses ps parsing
3. killdown
Shows processes in relation to eachother, and enables to kill a whole process tree
4. curses.pl
Used by px and px-ps to make the headers use screen attributes
5. Getopt::Long-2.31
The most recent Getopt::Long module, part of the CORE perl distribution, but I use more recent features, requiring newer versions of this module than shipped with perl-5.6.1
6. Proc::ProcessTable-0.34.tgz
The most recent Proc::ProcessTable module. Very much worth looking at if you want system independant scripts wrt ps
Have (a lot of) fun!
BTW I use px zillions of times a day, and almost never use ps anymore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2002 01:37 AM
06-14-2002 01:37 AM
Re: favourite sysadmin scripts you always keep around....
eg: I want to kill processes of user sukant
# for i in `ps -ef|grep sukant | cut -c 10-14`
> do
> kill -9 $i
> done
Regards,
Sukant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2002 03:03 AM
06-14-2002 03:03 AM
Re: favourite sysadmin scripts you always keep around....
# !/bin/sh
# Script to send by e-mail statistics on some backup report
# 1) "LIST OF BACKUP SESSION"
# 2) "CLIENT STATISTICS"
# 3) "SESSION OBJECT REPORT"
#
datestr=`date '+%Y/%m/%d'`
#### LIST OF BACKUP SESSION ####
/opt/omni/bin/omnirpt -report list_sessions -timeframe 24 24 -html -email MY-EMAIL_ADDRESS
#### SESSION OBJECT REPORT ####
/opt/omni/bin/omnirpt -report session_objects -session $datestr-1 -html -email MY-EMAIL_ADDRESS
/opt/omni/bin/omnirpt -report session_objects -session $datestr-2 -html -email MY-EMAIL_ADDRESS
#### CLIENT STATISTICS ####
/opt/omni/bin/omnirpt -report host_statistics -timeframe 24 24 -html -email MY-EMAIL_ADDRESS
#### LIST MEDIA ####
/opt/omni/bin/omnirpt -report media_list -html -email MY-EMAIL_ADDRESS
I've 2 session objet in my office backup $datestr-1 and $datestr-2 .... in a my script session (#### SESSION OBJECT REPORT ####)
Naturally you must replace instead of MY-EMAIL_ADDRESS his/her own e-mail address.
For further information and other report look "man omnirpt".
Regards
Ernesto.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2002 03:42 AM
06-14-2002 03:42 AM
Re: favourite sysadmin scripts you always keep around....
I'm going to have fun with that!
PS: know what happens if you enter root? ;)
Later,
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2002 05:07 AM
06-14-2002 05:07 AM
Re: favourite sysadmin scripts you always keep around....
) rather than a response to this one. Oops
I'll try again...
I've written a report to generate an HTML email report of the previous days OmniBack backups, restores and used media, with color codes and clickable links.
It's in the attachment as a shar file. It expands to 3 files, and shell wrapper, a perl script and a cgi perl script.
We run the shell script from cron each morning and it delivers 2 versions - 1 for the admins, and one for managers and team leads.
I tweaked it to remove site specific stuff, but it's self documented as to how to set it up, and my email is in there as well. Written with Perl5, HP-UX 10.20 and OmniBack 3.0. Fairly generic, but ya never know...
Cheers,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2002 12:55 AM
06-15-2002 12:55 AM
Re: favourite sysadmin scripts you always keep around....
This script is really helpful to me each time i need to kill blocking telnet user sessions from my server.
==> kick a user (deg) out of the system ;)
Execution:
L1000: home/deg>kick
-------------------------------
o o o oooo o o
o o o o o o o
oooo o o oooo
o o o o o o
o o o o o o o
o o o oooo o o
-------------------------------
0 to cancel
ENTER USER : deg
I know many of you will find this simple script very useful.
Cheers
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2002 06:24 AM
06-15-2002 06:24 AM
Re: favourite sysadmin scripts you always keep around....
The C programs are simple date manipulation programs that we use in a lot of our scripts to do things like get the date/time from 3 hours ago, 10 days from now, etc. Simply compile them to the same name as the c program without the extension - these compile fine an a number of other UNIX platforms.
The omni_audit.ksh shell script is the main one in this bunch which can show 1 of 2 things:
1) Failed sessions within the last X hours including a guess at the reason for the failure. VERY useful for large Omniback shops that tend to have at least a few failures each night.
2) Session queuing for the last X hours. Once again useful to help balance your Omniback schedule. One warning - the data this uses seems to get reset when you cycle Omniback so trying to see 5 weeks ago data probably won't show you very much.
Last warning - the filters used to parse output may need altered (see MSExchange) for shops using modules like Oracle, etc. since they change the name of sessions a bit. We only have the Exchange/Exchange 2000 filters so I dump this when creating output.
Sample output:
omni_audit.ksh: Generating list of sessions...
omni_audit.ksh: Checking for jobs that ended unsuccessfully.
Omniback failed jobs between Fri Jun 14 10:17:00 2002 and Sat Jun 15 10:17:00 2002
Datalist Session Status Reason Action
server.full 2002/06/14-26 Aborted I/O drive1 NA
** Rerun attempt 2002/06/14-28 Completed SUCESSFUL NA
*** Total Backups : 100
*** Total Successes : 100 (100.00%)
*** Total Failures : 0 (0.00%)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2002 11:24 AM
06-20-2002 11:24 AM
Re: favourite sysadmin scripts you always keep around....
It also converts the txt to html for the web. It isn't pretty, but it does the job.
Let me know if you think there is something missing.
Thanks,
Greg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2002 11:39 AM
06-20-2002 11:39 AM
Re: favourite sysadmin scripts you always keep around....
Now when he comes in, he uses the attached script to email any number of attachments to the email address of his choice.
And yes, we do have security measures in place.
HP-UX 11.0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2002 07:21 AM
06-21-2002 07:21 AM
Re: favourite sysadmin scripts you always keep around....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2002 11:57 PM
06-26-2002 11:57 PM
Re: favourite sysadmin scripts you always keep around....
However, our helpdesk does know who left the comany. So I made a script that sends a trimmed version of the passwd-file to the helpdesk with the kind request to check it for gone users.
So, once in a while I find a list on my desk with the users I can remove.
Here is the script:
#!/bin/sh
/usr/bin/cat /etc/passwd | /usr/bin/cut -f1,5 -d: | /usr/bin/grep -v amor | /usr/bin/grep -v root | /usr/bin/grep -v daemon | /usr/bin/grep -v bin | /usr/bin/grep -v sys | /usr/bin/grep -v adm | /usr/bin/grep -v uucp | /usr/bin/grep -v lp | /usr/bin/grep -v nuucp | /usr/bin/grep -v hpdb | /usr/bin/grep -v nobody | /usr/bin/grep -v ingres | /usr/bin/grep -v behehv | /usr/bin/grep -v ohoan | /usr/bin/grep -v wapla | /usr/bin/grep -v golmp | /usr/bin/grep -v tftp | /usr/bin/grep -v pcs | /usr/bin/grep -v hmmodel | /usr/bin/grep -v hmso | /usr/bin/grep -v rwslod | /usr/bin/grep -v lmpipe | /usr/bin/grep -v lmguest | /usr/bin/grep -v arcinfo | /usr/bin/grep -v simadm | /usr/bin/sort | /usr/bin/elm -s "please check the left users " helpdesk@mycompany.nl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 10:37 AM
06-27-2002 10:37 AM
Re: favourite sysadmin scripts you always keep around....
I got a small script to find the clock speed of system CPUS
if [ "`uname -r | cut -d. -f2`" = "11" ]
then ADB="adb -k"
else ADB="adb"
fi
echo "itick_per_tick/D" | ${ADB} /stand/vmunix /dev/kmem | awk 'NF == 2 {print $2 / 10000}'`
cheero
George
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 11:14 AM
06-27-2002 11:14 AM
Re: favourite sysadmin scripts you always keep around....
Later,
BOB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 11:33 AM
06-27-2002 11:33 AM
Re: favourite sysadmin scripts you always keep around....
Remove control-M's from a windows text file.
cat $1 | tr -d "\015"
Set your xwindows display variable
#!/bin/ksh
FRMHST=`who am i -u | awk -F"\ *" '{print $8}'`
DISPLAY=${FRMHST}:0.0
export $DISPLAY
echo DISPLAY var set to $DISPLAY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 12:20 PM
06-27-2002 12:20 PM
Re: favourite sysadmin scripts you always keep around....
Have this cronjob send you the morning report with the results of last nights backups.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2002 01:00 PM
06-27-2002 01:00 PM
Re: favourite sysadmin scripts you always keep around....
#!/bin/ksh
# extracts page(s) from a ps file into a new ps file
# assumes the use of %%Pages: (atend) in the prolog
###
PAGE_CNT=0
FILE= # source file name here
NEW_FILE= # target file name here
cat /dev/null>$NEW_FILE
TEMP_FILE=/tmp/temp_ps.$$ # this is a work file and gets deleted at
the end
STRING= # unique string to search to id the page(s) needed
QUOTE="'"
TOP=`grep -n "%%EndProlog" $FILE|cut -d":" -f1`
head -$TOP $FILE >$NEW_FILE
OLD_IFS=$IFS
egrep -n "$STRING|%%Page" $FILE|grep -v "Pages">$TEMP_FILE
exec 3<$TEMP_FILE
while read -u3 LINE; do
IFS=:
set $LINE
if [ "${2}" = "%%Page" ]; then
HOLD_ROW=$1 # remember this row number
STRING_FOUND=0
elif [ "${2}" = "%%PageTrailer" ]; then
if [ "${STRING_FOUND}" -eq 1 ]; then
END_ROW=$1p # last row of page
CMD="-n $QUOTE$START_ROW,$END_ROW$QUOTE"
eval "sed $CMD $FILE >>$NEW_FILE"
(( PAGE_CNT = $PAGE_CNT + 1 ))
fi
else
START_ROW=$HOLD_ROW # previous %%Page row is start of page
STRING_FOUND=1
fi
IFS=$OLD_IFS
done
# add ending comments to ps file #
TOTAL_PAGES=$PAGE_CNT # end of document
echo "%%Trailer" >>$NEW_FILE
echo "%%Pages: "$PAGE_CNT >>$NEW_FILE
echo "%%EOF" >>$NEW_FILE
IFS=$OLD_IFS
rm -i $TEMP_FILE
### end of script ###
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2002 03:43 AM
06-28-2002 03:43 AM
Re: favourite sysadmin scripts you always keep around....
A small script to create the mirror of the boot disk.
Regards, Vicente.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2002 06:26 AM
06-28-2002 06:26 AM
Re: favourite sysadmin scripts you always keep around....
little script to store smb.conf information by testparm regarding multiple fileserver instances:
---snip---
#!/bin/sh
#
#set -x
PATH=$PATH:/opt/samba/bin
LOGDATE='date +%d%m%y-%H%M%S'
usage () {
echo "USAGE: $0
}
if [ $# != 1 ]
then
echo "ERROR in usage"
usage
exit 1
fi
INST=$1
case $INST in
INSTANCE1) CONF=/etc/opt/samba/smb.conf.instance1
LOG=/var/opt/samba/inst1/logs/conf.`$LOGDATE`
;;
INSTANCE2) CONF=/etc/opt/samba/smb.conf.instance2
LOG=/var/opt/samba/inst2/logs/conf.`$LOGDATE`
;;
INSTANCE3) CONF=/etc/opt/samba/smb.conf.instance3
LOG=/var/opt/samba/inst3/logs/conf.`$LOGDATE`
;;
*) echo "ERROR: $INST is an unknown instance"
usage
exit 1
esac
(
date
testparm $CONF <
EOF
)
echo "CONFIG STORED IN $LOG"
---snip---
RGDS, Holger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2002 06:58 AM
07-01-2002 06:58 AM
Re: favourite sysadmin scripts you always keep around....
Not a scipt but a tweak.
Create in /usr/bin a file:-
mail(your initials) ie.
mailpjfc.
Give it execute permissions.
It should contain one line:-
mailx -s "From
So you want to transfer a file to your desktop then.
cat
or:-
strings
or:-
what
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2002 08:28 AM
07-01-2002 08:28 AM
Re: favourite sysadmin scripts you always keep around....
#!/usr/bin/ksh
USAGE="usage:rrun 'command' < i.e, uname -a or who -r >"
# Get command to run from command line
COMMAND=$*
# Check to see if it is blank
if [[ $COMMAND = "" ]]
then
print $USAGE
exit 1
fi
# Check for rm, mv, shutdown and other nasty commands and shut it down
# Enter your list of restricted commands below
if [[ "$COMMAND" = +(*rm*||*mv*||*reboot*||*shutdown*||*init*) ]]
then
echo
echo "******************************************"
echo
echo "Your command: $COMMAND"
echo "Will not allow rm, mv, init, reboot or shutdown!"
echo
echo "******************************************"
exit 1
fi
# If the command is not blank and not nasty then do it
for i in `cat /usr/local/etc/rrun.conf` #Name of file containing system names
do
print "************************ $i ***************************"
# print "Running the following command on $i:$COMMAND"
print $COMMAND
remsh $i -n $COMMAND
# print "***********************************************************"
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2002 09:36 AM
07-01-2002 09:36 AM
Re: favourite sysadmin scripts you always keep around....
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2002 10:37 AM
07-01-2002 10:37 AM
Re: favourite sysadmin scripts you always keep around....
powermt vgdisplay dev=all
The vgdisplay option was removed after PowerPath 1.5, but it provided a nice look at your EMC disks and where they were being used.
After we upgraded I wrote the attached. It can definately use a little cleanup and would probably run faster by drawing on powermt instead of syminq, but it works.
Here is a sample output:
S Y M M E T R I X
Mcode Cache Num Phys Num Symm
SymmID Attachment Model Version Size (MB) Devices Devices
000182401709 Local 3700 5265 8192 56 402
000182403007 Local 3700 5265 6144 82 309
=========>> Device: 0703A000 <<==========
/dev/dsk/c8t0d0: /dev/vgarbortest2
/dev/dsk/c10t0d0: /dev/vgarbortest2
=========>> Device: 0703B000 <<==========
/dev/dsk/c8t0d1: /dev/vgias_empr_test1
/dev/dsk/c10t0d1: /dev/vgias_empr_test1
=========>> Device: 0703C000 <<==========
/dev/dsk/c8t0d2: /dev/vgarbortest4
/dev/dsk/c10t0d2: /dev/vgarbortest4
=========>> Device: 0703D000 <<==========
/dev/dsk/c8t0d3: FREE
/dev/dsk/c10t0d3: FREE
=========>> Device: 0703E000 <<==========
/dev/dsk/c8t0d4: /dev/vgarbortest0
/dev/dsk/c10t0d4: FREE
...
As you can see, it lists each path to the same device. Note the last entry - it is showing FREE on one path because the PV Link was not set up.
David