- 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-22-2003 09:53 AM
07-22-2003 09:53 AM
Re: favorite sysadmin scripts you always keep around (3)
It has a parent script, T-REX, that I'll attach if anyone is interested. This script uses secure copy to deploy diskasaurus to machines listed in a text file. It then executes it and captures its output into a larger .csv file, and does some interesting subtotals and totals of the data. The first script runs by itself nicely, but with T-REX it becomes a powerful tool to analyze multiple systems simoultaneously.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2003 07:15 AM
07-24-2003 07:15 AM
Re: favorite sysadmin scripts you always keep around (3)
Well suffer no longer.
restart
Let me know if the name causes problems, it is tested.
usage:
restart
It requires root $LOGNAME
It requires a single parameter
It saves me typing.
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
07-25-2003 12:00 AM
07-25-2003 12:00 AM
Re: favorite sysadmin scripts you always keep around (3)
select p.spid from v$process p, v$session s, v$mystat m
where m.sid=s.sid and s.paddr=p.addr and rownum=1;
This is used to extract the pid of the session you are connected to.
Usefull because when you generate a user_trace (like in alter database backup controlfile to trace) the output goes to user_dump_dest/ora_
I always hate to list the content and look for my file, guessing...
Massimo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2003 06:18 PM
07-27-2003 06:18 PM
Re: favorite sysadmin scripts you always keep around (3)
In Linux you can stop, start and restart services with a single command.
service
service httpd restart
restarts the httpd daemon(web server)
Its nice.
As far as I know, no equivalent exists in HP-UX.
Until now.
It works just the same, taking three valid actions. It may be a bit verbose, but you can play with it to your hearts content.
attaching service.
This has been tested in all three valid modes.
If the script does not exist in /sbin/init.d/ it tells you.
WARNING: This script will not protect you from your own stupidity. If you use it to halt a critical service like NFS or the network, your system will lock up good and hard. Use at your own risk. Example: This script did not protect me from my own stupidity when I let it loose on Samba while a file transfer was going on. It is not smart enough to know if its a good idea to start/stop or restart the service, it relies on you for that part.
WARNING 2: There are probably some services that can't be stopped and started while the system is running. Once again, this script is only as smart as the person using. It does however ease the transition from Linux to HP-UX.
I'm thinking about doing chkcfg(chkconfig?) next. It actually sets up servcies to run which makes it a little harder to port.
Enjoy.
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
07-27-2003 06:34 PM
07-27-2003 06:34 PM
Re: favorite sysadmin scripts you always keep around (3)
Reason is I promised this pup months ago.
Its a really minor modification of a slick script given to me by Jordon Bean in response to an itrc post to port my Linux buildmail script.
What this script does is it builds the sendmail databases for alisees, access (spam stopper), and such things so you can use your HP-UX box to run an NSP.
I don't know how many people actually do that, but I'm in a jam right now.
My production Linux Server is running 7.3 Red Hat. It is having hardware problems. It only booted correctly six out of the last seven times. It hung on the memory check a few hours ago, after I loused up the named database.
A few weeks ago, its built in video card took a dump. The good news is it came back and the server wasn't down for more than 10 minutes.
What I need to do is take production offline, put in a reliable add in video card, put the two hard disks on different IDE channels and rebuild the box.
Normally I'd just switch to the backup Linux box. Its been upgraded to Red Hat 9 and none of my sendmail stuff works with sendmail 8.12.
So The old D320, my learning box may be pressed into a few days of service to save my tush.
DNS, httpd(apache 2 no less) works. sendmail has to work to give me the time I need to fix the Dell Linux box.
That was long winded. Here is the script. The script itself works. The sendmail functionaility it creates, databases and such is still being tested furious as I type.
Not surprisingly I was able to bring over all my virtusertable, genericstable, tab delimited databases without modification.
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
07-27-2003 10:00 PM
07-27-2003 10:00 PM
Re: favorite sysadmin scripts you always keep around (3)
Sometimes "who" shows users that are not logged on the system. I have attached a script that searches ghost users, and remove them.
Usually those users closed their X client application improperly.
Hope this helps somebody.
Kind regards,
Zigor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2003 10:46 PM
07-27-2003 10:46 PM
Re: favorite sysadmin scripts you always keep around (3)
One more, I usually use the attached script to find in a couple of seconds if a user is locked in the trusted system. If the user is locked due to max failed login attempts, or due to max inactivity time, then is automatically reactivated.
Hope this helps somebody.
Kind regards,
Zigor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2003 11:07 PM
07-27-2003 11:07 PM
Re: favorite sysadmin scripts you always keep around (3)
Attached a script that enable/disable passwd aging in trusted systems, only for those users whose home directory is "client". It can be adapted easily to meet other requirements.
We did this script because there are users excluded from using passwd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2003 02:22 AM
07-28-2003 02:22 AM
Re: favorite sysadmin scripts you always keep around (3)
find / -perm 4000 -o -perm 2000 -o -perm 1000
And can add any chmod masks one like (writable in /etc ... etc :) )
Zeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2003 11:21 AM
08-19-2003 11:21 AM
Re: favorite sysadmin scripts you always keep around (3)
It's written in perl and is in production here right now. Just change the paths and you'll be able to it yourself.
[]'s
Paulo Fessel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2003 12:37 PM
08-19-2003 12:37 PM
Re: favorite sysadmin scripts you always keep around (3)
du -ak $1 | sort -n > /tmp/dulist
tail -15 /tmp/dulist
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2003 04:12 PM
08-19-2003 04:12 PM
Re: favorite sysadmin scripts you always keep around (3)
#!/bin/ksh
for i in `ioscan -fnC disk |grep rdsk | awk '{ print $2 }'`
do
diskinfo -v $i
done
It's useful to have a hardcopy or at least the results redirected to a file. That way if you lose a disk and call for a replacement, you have the all important Product ID on hand.
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2003 04:50 PM
08-19-2003 04:50 PM
Re: favorite sysadmin scripts you always keep around (3)
Tim Sanko wrote:
> This finds largest files and tails out the 15 largest.
> My manger can use it...
> du -ak $1 | sort -n > /tmp/dulist
>tail -15 /tmp/dulist
I'd suggest telling the system to just find the interesting files before sorting.
Perhaps something like:
find $1 -size +10000000c -exec du -k {} \;| sort -n | tail -5
fwiw,
Hein.
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2003 06:56 AM
08-20-2003 06:56 AM
Re: favorite sysadmin scripts you always keep around (3)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2003 08:32 AM
08-20-2003 08:32 AM
Re: favorite sysadmin scripts you always keep around (3)
I can type-
mountcd /cdrom (to mount cd on /cdrom)
mountcd (to tell me if a cd is mounted and where)
#!/usr/bin/sh
cd=/dev/dsk/c4t3d0
arg1=$1
set -A ary `grep "^$cd" /etc/mnttab`
arg2=${ary[1]}
if [[ "x$arg2" = "x" ]] ; then
if [[ "x$arg1" = "x" ]] ; then
echo "Syntax : mountcd /MOUNT_POINT"
else
if [[ -d $arg1 ]] ; then
mount -r $cd $arg1
else
echo "$1 is not a DIRECTORY"
fi
fi
else
if [[ "x$arg1" = "x" ]] ; then
echo "CDROM mounted at $arg2"
else
echo "CDROM already mounted at $arg2"
fi
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2003 11:11 AM
08-20-2003 11:11 AM
Re: favorite sysadmin scripts you always keep around (3)
attached is a script i use for file management.
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2003 12:24 PM
08-21-2003 12:24 PM
Re: favorite sysadmin scripts you always keep around (3)
I also have to explain it to my manager who thinks he is "hands on". I have tried to explain "find / -name \*.sar -exec gzip {} \;"
to her for enough time to avoid find forever.
I also have had to explain the syntax for awk (feel the shudder)...
Sometimes simple is better, but not always...
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2003 04:30 AM
08-22-2003 04:30 AM
Re: favorite sysadmin scripts you always keep around (3)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2003 03:04 AM
08-23-2003 03:04 AM
Re: favorite sysadmin scripts you always keep around (3)
Hi all,
Not a script really but continuing from Tom Sanko and Hein Van Den Heuvel:
To find n largest files, example (largest 20):
largestFiles /oracle 20
Here's the technique:
find $1 -size +10000000c -exec du -k {} \;| sort -n | tail -$2 | more
It worked for me....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2003 06:18 AM
08-27-2003 06:18 AM
Re: favorite sysadmin scripts you always keep around (3)
This script allows you to specify warning and critical thresholds for individial filesystem, groups of filesystems (identified with regular expressions) and even filesystems on a range of machines. It can alert to openview, it can keep a database which allows for specifying thresholds and re-arm values. It has the code (commented out) for doing the job across a range of different machines. If checking several machines, those machines can be either HP-UX, Solaris, AIX or Linux or a mixture of them.
You'll need to create a config file but an example is in the comments of the script.
Mail me if it needs tweaks for your environment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2003 07:11 AM
08-27-2003 07:11 AM
Re: favorite sysadmin scripts you always keep around (3)
below is one of my weekly cron jobs for backup.
NOTE: Only the hostnames are not original. The script is used in a 4 server environment where 2 servers are used as ignite servers.
regards, Holger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2003 12:05 PM
08-27-2003 12:05 PM
Re: favorite sysadmin scripts you always keep around (3)
Apparently it went from lively to death in less than the 24 hour window between check runs.
So I needed something that could spot a problem if a drive dies without an lbolt.
The idea came to mind to use strings /etc/lvmtab as a database. Then run a pvdisplay and if the error code returns 0 the disk must be okay. If non-zero, email me FAST.
So I wrote this script.
This script is tested, so I think it qualifies for points. I tested it against an invalid copy of lvmtab and it did indeed email me saying a disk was down. The nice part was that it included the /dev/dsk/c###### info on the email subject line.
Anyway, here it is. It actually emails a bunch of people, but I cut those out for privacy concerns. Everyone here knows my email addy anyway.
disk.status.....
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
08-27-2003 12:19 PM
08-27-2003 12:19 PM
Re: favorite sysadmin scripts you always keep around (3)
It searches for key words and email the unix admins and or a pager.
It use the module File::Tail
It is not inteligent enough, to sense when you switch the log file (yet), so remember to stop and start the daemon when you rotate the logs.
peace
Donny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2003 03:20 AM
09-10-2003 03:20 AM
Re: favorite sysadmin scripts you always keep around (3)
Example support files included.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2003 03:25 AM
09-10-2003 03:25 AM
Re: favorite sysadmin scripts you always keep around (3)
find / -name core -type f -exec echo "\n" \; -exec file {} \; -exec what {} \;