- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- favorite 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
07-15-2004 12:52 AM
07-15-2004 12:52 AM
Re: favorite sysadmin scripts you always keep around (3)
I want to share my backup/verify tool called Miniback.
Yes, i stole the name from Omniback, but since it is quite small, hence miniback.
Anyway, this is what it does.
It uses the fbackup/frecover combo to make a backup, and this backup is checked by restoring a file with frecover.
A short manual is supplied.
Since we use HP Openview, it reports errors through HPOV. If you dont like that, then you can switch it off.
I attached this as a depot file.
It will install the scripts into /var/adm/fbackupfiles.
IT WILL OVERWRITE FILES THERE...
Be warned
Have fun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2004 08:06 PM
07-22-2004 08:06 PM
Re: favorite sysadmin scripts you always keep around (3)
Here is a version of one of the bdf extension script, where there is filesystems with longname. Here inodes are included in the script.
Regards,
Borislav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2004 01:36 AM
07-23-2004 01:36 AM
Re: favorite sysadmin scripts you always keep around (3)
Setup of this script is to create rrun.conf file and put there the list of needed servers. It uses .rhosts trusting.
Script I attached is written by somebody else from ITRC I downloaded it long time ago and since now it is ome of my favourites.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2005 08:00 PM
12-29-2005 08:00 PM
Re: favorite sysadmin scripts you always keep around (3)
some one-line commands usefull to administarte Oracle mount points:
# Show oracle disk with pct used >= PCT
bdf|awk -v PCT=30 'NR==1||(substr($5,1,index($5,"%")-1)+0>=PCT&&/oracle/)'
# Show Oracle disk with available space >= AVL (1Mb)
bdf|awk -v AVL=1048576 'NR==1||($4>=AVL&&/oracle/)'
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2005 03:13 AM
12-30-2005 03:13 AM
Re: favorite sysadmin scripts you always keep around (3)
Am sure a Perl Wiz should be able to re-write this and make it faster/more efficient but it does work for me:
#!/bin/ksh
#
# dginfo
# Show a server's VxVM Configuration and Layout
#
echo "DGINFO - VxVM Summator v 1.0 Dec. 2005"
echo "VxVM - All Versions"
echo "AITS Unix"
DGLIST=`vxdg list|awk '{print $1}'|grep -v "NAME"`
echo
echo "VxVM Summary for Server `hostname` @ `date`"
echo
for DG in $DGLIST;do
# Get Total Allocations
SIZE=`vxprint -ht -g $DG|grep ^dm|awk '{s+=$6}END{printf "%8.2f",s/1024/1024}'`
FREE=`vxdg -g $DG free|grep -v DISK|awk '{s+=$5}END{printf "%8.2f",s/1024/1024}'`
printf "DG: %-20s Capacity: %7.2f GB Free: %7.2f GB\n" $DG $SIZE $FREE
echo "=========================================================================="
vxprint -ht -g $DG|grep ^v|grep -v dcl|awk '{print $2,$6}'|while read vol size;do
fs=`mount -p|grep -w /dev/vx/dsk/$DG/$vol|awk '{print $2}'`
printf "VOL: %-20s %10d GB. %30s\n" $vol $((size/1024/1024)) $fs
done
printf "\n"
done
Favourite Toy:
AMD Athlon II X6 1090T 6-core, 16GB RAM, 12TB ZFS RAIDZ-2 Storage. Linux Centos 5.6 running KVM Hypervisor. Virtual Machines: Ubuntu, Mint, Solaris 10, Windows 7 Professional, Windows XP Pro, Windows Server 2008R2, DOS 6.22, OpenFiler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2005 03:42 AM
12-30-2005 03:42 AM
Re: favorite sysadmin scripts you always keep around (3)
#! /usr/bin/ksh
# This script will kill any processes that are running. Good if there are a bunch of them, like Java or http.
# You must supply the process and the userid when running the script
echo "Process Name? \c"
read ans
echo "Userid? \c"
read user
ps -ef |grep $ans | grep $user |grep -v grep |awk '{print $2}' |while read PID
do
kill -9 $PID
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2005 05:12 AM
12-30-2005 05:12 AM
Re: favorite sysadmin scripts you always keep around (3)
For those who like this same idea on VMS, the OPENVMS.ORG people created a separate site:
http://dcl.openvms.org/
Well worth a visit, lots of interesting stuff there! (even some of mine).
Happy New year (carefull with the fireworks, they DO make nice glass eyes, but they still have inferior vision!).
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2005 05:33 AM
12-30-2005 05:33 AM
Re: favorite sysadmin scripts you always keep around (3)
Anyway, a couple of comments on Sally's "kill script" contribution:
First, simply grepping a user name or command can be dangerous. There is always the possibility that an inadvertent match may end up killing something that you didn't really want to kill. A far better alternative is to use the XPG4 functionality of the ps command like this -
PROCESSES=`UNIX95= ps -U $USERNAME | grep -v PID |awk '{ print $1 }'
A similar technique is, I believe, available for the command, using the XPG4 option "-C".
Secondly, doing an arbitrary "kill -9" gives the process no chance to clean up after itself, leaving shared memory segments, etc, still occupied. At the very least, a plain
kill, which defaults to SIGTERM, or kill -15, should be tried before resorting to kill -9. Something like this -
kill $PROCESS
sleep 2
kill -9 $PROCESS
Just a couple of suggestions.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2005 11:50 AM
12-30-2005 11:50 AM
Re: favorite sysadmin scripts you always keep around (3)
ps -f -u user_name
Similarly, to find a process, always use -C process_name and you won't get any mistakes. Check the difference between these two commands:
ps -ef|grep sh
UNIX95=1 ps -f -C sh
You'll see not only sh shell processes, but possibly ksh, csh, bash, and most important: unhasdaemon. You NEVER want to kill unhasdaemon.
Now there are 3 really useful options that are non-standard with ps: -C -H and -o. Check the man page for the details. But these options only wirk when the (normally undefined) variable UNIX95 exists. Don't be tempted to set UNIX95 permanemntly as this variable can affect other processes and libraries. Put it on the same line as ps.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2005 08:37 AM
12-31-2005 08:37 AM
Re: favorite sysadmin scripts you always keep around (3)
I did produce a safe version of the kill script that was never allowed to touch a process owned by room. Those are best killed manually.
I've been converting my grep kill script to the new, safer Bill Hassell method.
I've been thinking of creating a searchable database of all these scripts based on keywords.
Perhaps maintain the database of characteristics in a sql database. I'd need a we bit of help getting that done. Interesting concept, great script database, sometimes hard to find it where it sits now.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2006 07:56 AM
01-02-2006 07:56 AM
Re: favorite sysadmin scripts you always keep around (3)
UNIX95=1 ps -e -o vsz,pid,ruser,args | sort -rn
To log this as a 1-liner, change the line to:
UNIX95=1 ps -e -o vsz,pid,ruser,args | sort -n | tail -1
This will put the biggest (local memory) process at the end of the list. That said, memory usage by a process is a lot more complicated than just local memory. A set of processes may share an enormous segment of memory but that is by design. Similarly, a process may need a lot of local memory to run correctly. Large memory usage is not a bad thing if the program is running correctly. HP-UX is a virtual memory system and will deactivate and page out low priority programs when RAM is fully used.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2006 02:20 AM
01-04-2006 02:20 AM
Re: favorite sysadmin scripts you always keep around (3)
ps -ef |grep -v informix|grep -v root |grep -v lp|awk '{print $4, $1, $2, $7, $8, $9, $10, $11, $12,$13, $14, $15}' |sort -r| head -10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2006 06:55 AM
01-04-2006 06:55 AM
Re: favorite sysadmin scripts you always keep around (3)
id_mirror: IDs which lvs in vg00 are mirrored and which aren't...
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2006 08:07 AM
01-04-2006 08:07 AM
Re: favorite sysadmin scripts you always keep around (3)
Primarily used to identify pvlinked disks thata aren't part of a vg.
Unfortunately, this one needs a little work. Biggest issue is identifying the cdrom/dvdrom or any of the other names by which it goes on the various systems. (line 67). Once that's done, it works pretty well, at least on the systems that I've run it on...
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2006 08:10 AM
01-04-2006 08:10 AM
Re: favorite sysadmin scripts you always keep around (3)
Useful for scanning multiple hosts simultaneously if you have ssh pka and gsh configured...
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2006 03:30 AM
06-09-2006 03:30 AM
Re: favorite sysadmin scripts you always keep around (3)
1. On main developer's WinXP machine, set up
a scheduled task to run send_files.bat which is nothing more than a automated ftp using 'ftp -s:send_files.txt' which connects to the unix machine as a generic ftp user to dump the excel files.
2. Cron job on unix box runs daily with the attached script to prep the files for emailing. The excel files on the WinXP box always stay the same whereas the script will use perl to munch on the name of the new files on the unix box.
Example: WinXP sends over the file 'one.xls'. Perl script makes that turn into 'one06092006.xls' before it gets sent out.
Safeguards:
- any argument will show a debug mode checking to see if excel files already renamed exists and ignores them
- doesn't do anything if 0 files exist
- directory and path traversal stuff
- strict mode enabled, of course
- entirely perl, no system or exec calls
And there it is, hehe...it's in production.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2006 03:02 AM
09-08-2006 03:02 AM
Re: favorite sysadmin scripts you always keep around (3)
Todays date
$ export _dt=$(date "+%m")$(date "+%d"|bc)$(date "+%y")
$ echo $_dt
09806
Yesterdays date
$ export _dt=$(date "+%m")$(date "+%d - 1"|bc)$(date "+%y")
$ echo $_dt
09706
It's all in the 'bc'. Hope this is as handy for others as it has been for me.
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2006 03:23 AM
09-08-2006 03:23 AM
Re: favorite sysadmin scripts you always keep around (3)
Yesterdays date
$ export _dt=$(date "+%m")$(date "+%d - 1"|bc)$(date "+%y")
$ echo $_dt
09706
1) Not too serious because it is not very probable:
$ export _dt=$(date "+%m")$(date "+%d - 1"|bc)$(date "+%y")
Invoking date 3 separate times could result in an invalid date because this could occur at midnite so that the month, day, and/or year might not agree. A single call to fewtch all three in one shot is much better.
2) Serious and quite likely to occur:
Consider what happens when this script is run on the first day of any month. I'm not aware of too many calendars that allow a day 0 (although the math would be easier if calendars were zero-based).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2006 04:53 AM
09-08-2006 04:53 AM
Re: favorite sysadmin scripts you always keep around (3)
I've incorporated it into a few things without any problems. And haven't seen anyone else find yesterdays date with such little effort.
PS: please, no points for ether post - it's just a small contribution
Thanks,
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2006 01:47 PM
10-24-2006 01:47 PM
Re: favorite sysadmin scripts you always keep around (3)
It sleeps for 100ths of a second, accurate to within .03 seconds (usually over).. I believe that it's due to the way the system schedules processes to run.. it's .01 accurate if I run it in rtprio.
I like it for when I'm dumping a stream of commands into a telnet ( telnet SERVERNAME < $(echo ls; sleep 1; echo bdf) )..
I noticed that HP had provided a nanosleep function in time.h, but nobody had taken advantage of it, and a few people had asked for one on the ITRC.
In reality, it's not very usefull outside of starting to learn C...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2006 01:49 PM
10-24-2006 01:49 PM
Re: favorite sysadmin scripts you always keep around (3)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2007 03:01 AM
04-11-2007 03:01 AM
Re: favorite sysadmin scripts you always keep around (3)
it's time for revival of this thread.
this script is adapted from a script found here (i don't remeber who) and contains ameliorations.
the output is like that:
#> bdfa /var
File System Mbytes Used Avail %Used Inods Free %Used Type Mounted on
/dev/vg00/lvol7 6144 1669 4440 27% 35211 143189 20% vxfs /var
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2007 03:06 AM
04-11-2007 03:06 AM
Re: favorite sysadmin scripts you always keep around (3)
there is an alias you can insert in the /etc/profile in replacement of the 'bdf' command...without the ugly line return.
this alias is attached because there are tabulations in, old sed versions don't know of the \t char.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2007 03:12 AM
04-11-2007 03:12 AM
Re: favorite sysadmin scripts you always keep around (3)
under solaris, you have ptree for listing process, there is a small equivalent for HP-UX.
you can launch with the following args:
ptree 0
for a complete listing
or the following example:
# ptree 6913
+++++ root 1 0 0 Mar 22 ? 11:37 init
++++ root 1025 1 0 Mar 22 ? 0:40 /opt/ssh/sbin/sshd
+++ root 29222 1025 0 12:47:52 ? 0:00 sshd: root@pts/0
++ root 29227 29222 0 12:47:54 pts/0 0:00 -ksh
+ root 29497 29227 0 12:47:57 pts/0 0:00 bash
0 root 6913 29497 0 17:08:51 pts/0 0:00 ksh
- root 6917 6913 0 17:08:52 pts/0 0:00 bash
-- root 7123 6917 0 17:08:54 pts/0 0:00 ksh
--- root 8527 7123 1 17:09:35 pts/0 0:00 /bin/ksh /outil/adm/bin/ptree 6913
---- root 8530 8527 1 17:09:35 pts/0 0:00 ps -ef
i've launched multiples shells specially for this example ;)
Regards,
Cedrick Gaillard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2007 03:19 AM
04-11-2007 03:19 AM
Re: favorite sysadmin scripts you always keep around (3)
under solaris, you have pkill for kill process, there is a small equivalent for HP-UX.
the syntax is:
pkill -U
process is a processname, fo example:
pkill -U root bdaemon
first, it will kill the process normally, if that don't work, it will do a kill -11, if that still don't work, it will kill -9 the process.
Regards,
Cedrick Gaillard