- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: favorite sysadmin scripts you always keep arou...
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
Discussions
Discussions
Forums
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
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
тАО04-11-2007 03:29 AM
тАО04-11-2007 03:29 AM
Re: favorite sysadmin scripts you always keep around (3)
if you'r- out of memory ( in your brain, not the server;) ), here is the perfect alias:
alias sepath='echo ${PATH} | tr ":" "\n" | xargs ls |sort -u |egrep -i "${@}"'
you can test:
# sepath grep
egrep
fgrep
grep
nisgrep
zgrep
Regards,
Ceddrick Gaillard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-11-2007 03:42 AM
тАО04-11-2007 03:42 AM
Re: favorite sysadmin scripts you always keep around (3)
if you want to send a root terminal to your colleague and have a log of waht heis typing, this script is made for you (it's not made by me).
work for HP-UX and other Unix systems.
the logfile is /usr/local/log/sendxterm.${user}.`date +%Y%m%d`.`date +%H%m%S`.$$.log
the syntax is:
sendxterm -d 192.168.1.2
Regards,
Cedrick Gaillard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-11-2007 11:11 PM
тАО04-11-2007 11:11 PM
Re: favorite sysadmin scripts you always keep around (3)
if your ssh connexion seems too long, you can purge your [uwb]tmp files, this script attached will do it for you.
example before the purge,
/var/adm/wtmp was 239Mo :
# time ssh nr0u0151 "uname -n"
nr0u0151
real 0m58.58s
user 0m0.09s
sys 0m0.02s
after the purge of /var/adm/wtmp:
# time ssh nr0u0151 "uname -n"
nr0u0151
real 0m1.73s
user 0m0.09s
sys 0m0.01s
Regards,
Cedrick Gaillard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2007 06:24 AM
тАО05-02-2007 06:24 AM
Re: favorite sysadmin scripts you always keep around (3)
Here is a script to verify all man pages are at your finger tips.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2007 06:41 AM
тАО05-02-2007 06:41 AM
Re: favorite sysadmin scripts you always keep around (3)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2007 06:42 AM
тАО05-02-2007 06:42 AM
Re: favorite sysadmin scripts you always keep around (3)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2007 07:33 AM
тАО05-02-2007 07:33 AM
Re: favorite sysadmin scripts you always keep around (3)
Problem:
Oops! I didn't want to delete that:
Solution:
del (reversible rm)
Usage:
Once in the habit of using del path [...]
rather than rm path [...], accidental deletions can be restored from the ~/.deleted directory. Weekly, I purge the ~/.deleted directory of files more than 7 days old.
Emacs and other packages are configured to put their backups in ~/.deleted, thus reducing filespace clutter.
Problem:
Users complain of mysterious package failures when they run setup scripts too often and exceed environment string length,
causing misconfiguration.
Solution:
Idempotent path extension. i.e. If already in path variable, move to front of list and remove duplicate.
Usage:
This snippet is modified and incorporated into scripts that setup a user's environment for particular package use. Thereafter the user simply runs the setup script before using the package. If there are two or more users, one can execute the script before every usage, and the other may execute the script only once, but neither complains of failure due to exceeding environment string length.
Hopefully helpful,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-05-2007 10:40 PM
тАО07-05-2007 10:40 PM
Re: favorite sysadmin scripts you always keep around (3)
Two small scripts for lan connectivity
1.To check which are the lan ports connected to the lan switches, if you have multiple lan ports connected but not assigned ip addresses.
lanscan | awk '{print $2,$5}' | tail +3 | while read mac ppa
do
linkloop -i $(echo $ppa | sed -e 's/lan//g') $mac 1> /dev/null 2>&1
if [[ "$?" = 0 ]]
then
echo $ppa connected
fi
done
2. To check which lan ports of one server are accessible to the lan ports of other server at the Link layer. This is mostly useful when you are doing the connectivity for Cluster, providing redundant links using redundant switches and lan ports.
This requires remsh/rcp to be enabled on the 2 servers/ can replace by ssh and scp as appropriate
remsh server2 -n "/usr/sbin/lanscan > /tmp/lanscansrv2.out"
rcp server2:/tmp/lanscansrv2.out /tmp
cat /tmp/lanscansrv2.out | tail +3 | awk '{print $2,$3}' | while read addr ppa
do
lanscan | tail +3 | awk '{print $2,$3}' | while read selfaddr selfppa
do
linkloop -i $selfppa $addr > /tmp/linkloop.out 2>&1
OK=$(grep -c OK /tmp/linkloop.out)
if [[ "$OK" = "1" ]]
then
echo "server1: lan$selfppa $selfaddr can reach server2: lan$ppa $addr"
fi
done
done
Regards,
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-05-2007 10:55 PM
тАО07-05-2007 10:55 PM
Re: favorite sysadmin scripts you always keep around (3)
Again 2 small scripts for checking mirroring on vg00.
1. Check mirror status of lvols in /dev/vg00. This can be useful to check how much of mirroring is completed if you running mirroring in background
for LVNAME in $(vgdisplay -v /dev/vg00 | grep 'LV Name' | awk '{print $NF}')
do
MIRROR=$(lvdisplay -v $LVNAME | grep 'Mirror copies' | awk '{print $NF}')
if [[ $MIRROR != 0 ]]
then
totalext=`lvdisplay -v $LVNAME | awk '/Logical extents/,/zzz/' | egrep -v
"^$" | tail +3 | wc -l`
syncedext=`lvdisplay -v $LVNAME | awk '/Logical extents/,/zzz/' | egrep -
v "^$" | tail +3 | awk '{print $NF}' | grep -c current`
echo "Mirroring for $LVNAME is $(echo "($syncedext*100)/$totalext" | bc)
% completed"
fi
done
2. Check stale PEs in mirrored lvols in /dev/vg00. This can be run as a shceduled job to regularly check if all lvols have synced PEs/mirroring
for lvname in $(vgdisplay -v /dev/vg00 | grep 'LV Name' | awk '{print $NF}')
do
MIRROR=$(lvdisplay -v $lvname | grep 'Mirror copies' | awk '{print $NF}')
if [[ $MIRROR != 0 ]]
then
MIRROR_STATUS=$(lvdisplay -v $lvname | grep -c -i stale)
if [[ $MIRROR_STATUS != 0 ]]
then
echo $lvname has stale PEs
else
echo $lvname is mirrored
fi
fi
done
Regards,
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2008 01:10 AM
тАО09-05-2008 01:10 AM
Re: favorite sysadmin scripts you always keep around (3)
#!/usr/bin/sh
#strt=$(ioscan -funC disk | awk '/rdsk/{print $2}')
# Following part modified from Radhakrishnan's script . . .
#
strt=$(ioscan -funC disk |awk '{ if ($3 != "") printf ("%s",$0) ; else printf ("%s\n",$0)}' |grep -v DVD-ROM | grep -v Class | awk '/rdsk/{print $10}')
i=0
p1=0
pT=0
echo $strt > /tmp/siliniz
clear
for i in `cat /tmp/siliniz`
do
p1=$(diskinfo -b $i)
pT=$(expr $p1 + $pT)
done
Tot=$(expr $pT / 1048576)
echo "-------------------------"
echo " Total Disk Size: $Tot GB"
/usr/bin/rm /tmp/siliniz