From: Gerard Henry (Gerard.Henry@cmi.univ-mrs.fr)
Date: Wed Apr 23 2003 - 05:36:30 EDT
many thanks to all for your responses.
sbhatia@siue.edu
s.evans@TriCorInd.com
alex@posixnap.net
mh1272@yahoo.com
vogelke@pobox.com
t@trey.net
stephan.grund@isst.fhg.de
dledger@ivdcs.demon.co.uk
SDaubigne@bordeaux-bersol.sema.slb.com
and specially for Sebastien DAUBIGNE, because i will use his command in
my crontab:
ps -eo pcpu,pid,args | awk '/netscape/ && $1 > 5 {print $2}' | xargs -n
10 kill -9
my first mail was not so clear, i want to automatically kill process
such netscape because they are bugged, i don't want to do it by hand.
Here is some contributions:
******************************************************************************
form Evans, Shawn:
#!/bin/sh
#
PROC=netscape
NUM=50
CPU=`prstat 1 1 | grep $PROC | awk '{print $9}' |awk -F. '{print $1}'`
#
if [ $CPU -ge $NUM ] ; then
kill -9 `ps -ef | grep -i $PROC`
fi
from Alex J. Avriette:
is there something wrong with ps -ef | grep netscape | awk '{ print $2 }'
******************************************************************************
from Karl Vogel:
You might want to do it by hand using the script below; it looks for
the processes on the command line and puts you in VI to pick the
ones
you want to kill.
---------------------------------------------------------------------------
#!/bin/ksh
#
# $Id: skill-solaris.sh,v 1.3 2001/04/29 22:15:13 vogelke Exp $
# $Source: /src/opt/scripts/RCS/skill-solaris.sh,v $
#
# NAME:
# skill
#
# SYNOPSIS:
# skill [-signal] [-dhinv] {tty user command pid regexp}
#
# DESCRIPTION:
# "skill" is a program to blow away processes. You can specify
# processes by tty, userid, command name, process id, or an
# egrep-style regular expression.
#
# OPTIONS:
# -d, --debug show debug output
# -h, --help print this message
# -i, --interact edit the process list before killing
# -n, --nokill show processes but don't kill them
# -v, --version print the version and exit
#
# AUTHOR:
# Karl Vogel <vogelke@dnaco.net>
# Sumaria Systems, Inc.
# Based on a script by Tom Christiansen -- tchrist@convex.com
#
# A similar script by Ric Anderson <ric@rtd.com>:
# ftp://jaguar.cs.utah.edu/pub/skill/skill-3.7.tar.Z
PATH=/bin:/usr/sbin:/usr/bin:/usr/local/bin
: ${EDITOR=/bin/vi} # Set default editor if blank.
export PATH EDITOR
umask 022
tag=`basename $0`
tmp=/tmp/skilltmp.$$
plist=/tmp/skillps.$$
trap "rm -f $tmp $plist" 0
trap "rm -f $tmp $plist; exit 1" ERR # ksh variants only
# ======================== FUNCTIONS =============================
#
# die: prints an optional argument to stderr and exits.
# A common use for "die" is with a test:
# test -f /etc/passwd || die "no passwd file"
# This works in subshells and loops, but may not exit with
# a code other than 0.
die () {
echo "$tag: error: $*" 1>&2
exit 1
}
# usage: prints an optional string plus part of the comment
# header (if any) to stderr, and exits with code 1.
usage () {
lines=`egrep -n '^# (NAME|AUTHOR)' $0 | sed -e 's/:.*//'`
(
case "$#" in
0) ;;
*) echo "usage error: $*"; echo ;;
esac
case "$lines" in
"") ;;
*) set `echo $lines | sed -e 's/ /,/'`
sed -n ${1}p $0 | sed -e 's/^#//g' |
egrep -v AUTHOR:
&nbme - name the current table
> print - display the current table
> label - write partition map and label to the disk
> !<cmd> - execute <cmd>, then return
> quit
> partition> p
> Current partition table (original):
> Total disk cylinders available: 7506 + 2 (reserved cylinders)
>
> Part Tag Flag Cylinders Size Blocks
> 0 unassigned wm 10 - 6685 15.00GB
> (6676/0/0) 31457312
> 1 unassigned wu 0 0 (0/0/0)
> 0
> 2 backup wu 0 - 7505 16.86GB
> (7506/0/0) 35368272
> 3 unassigned wu 0 0 (0/0/0)
> 0
> 4 unassigned wu 0 0 (0/0/0)
> 0
> 5 unassigned wu 0 0 (0/0/0)
> 0
> 6 unassigned wu 0 0 (0/0/0)
> 0
> 7 unassigned wm 0 - 9 23.01MB (10/0/0)
> 47120
>
> partition> label
> Ready to label disk, continue? y
>
> partition> q
>
>
> FORMAT MENU:
> disk - select a disk
> type - select (define) a disk type
> partition - select (define) a partition table
> current - describe the current disk
> format - format and analyze the disk
> repair - repair a defective sector
> label - write label to the disk
> analyze - surface analysis
> defect - defect list management
> backup - search for backup labels
> verify - read and display labels
> save - save new disk/partition definitions
> inquiry - show vendor, product and revision
> volname - set 8-character volume name
> !<cmd> - execute <cmd>, then return
> quit
> format> q
> [/root]
> [root@prdlog(PRDLOG)]>
>
> [/root]
> [root@prdlog(PRDLOG)]>metadb
> flags first blk block count
> a m p luo 16 1034
> /dev/dsk/c0t0d0s7
> a p luo 1050 1034
> /dev/dsk/c0t0d0s7
> a p luo 2084 1034
> /dev/dsk/c0t0d0s7
> a p luo 16 1034
> /dev/dsk/c0t1d0s7
> a p luo 1050 1034
> /dev/dsk/c0t1d0s7
> a p luo 2084 1034
> /dev/dsk/c0t1d0s7
>
> [root@prdlog(PRDLOG)]>tail -16 /etc/system
> * Begin MDD root info (do not edit)
> forceload: misc/md_trans
> forceload: misc/md_raid
> forceload: misc/md_hotspares
> forceload: misc/md_stripe
> forceload: misc/md_mirror
> forceload: drv/pcipsy
> forceload: drv/simba
> forceload: drv/uata
> forceload: drv/dad
> rootdev:/pseudo/md@0:0,1,blk
> * End MDD root info (do not edit)
> * Begin MDD database info (do not edit)
> set md:mddb_bootlist1="dad:7:16 dad:7:1050 dad:7:2084
> dad:15:16 dad:15:1050"
> set md:mddb_bootlist2="dad:15:2084"
> * End MDD database info (do not edit)
>
> [/root]
> [root@prdlog(PRDLOG)]>metadb -a -c 3 /dev/rdsk/c1t3d0s7
> /dev/rdsk/c1t5d0s7
> [/root]
> [root@prdlog(PRDLOG)]>metadb
> flags first blk block count
> a m p luo 16 1034
> /dev/dsk/c0t0d0s7
> a p luo 1050 1034
> /dev/dsk/c0t0d0s7
> a p luo 2084 1034
> /dev/dsk/c0t0d0s7
> a p luo 16 1034
> /dev/dsk/c0t1d0s7
> a p luo 1050 1034
> /dev/dsk/c0t1d0s7
> a p luo 2084 1034
>
From: Gerard Henry (Gerard.Henry@cmi.univ-mrs.fr)
Date: Wed Apr 23 2003 - 05:36:30 EDT
many thanks to all for your responses.
sbhatia@siue.edu
s.evans@TriCorInd.com
alex@posixnap.net
mh1272@yahoo.com
vogelke@pobox.com
t@trey.net
stephan.grund@isst.fhg.de
dledger@ivdcs.demon.co.uk
SDaubigne@bordeaux-bersol.sema.slb.com
and specially for Sebastien DAUBIGNE, because i will use his command in
my crontab:
ps -eo pcpu,pid,args | awk '/netscape/ && $1 > 5 {print $2}' | xargs -n
10 kill -9
my first mail was not so clear, i want to automatically kill process
such netscape because they are bugged, i don't want to do it by hand.
Here is some contributions:
******************************************************************************
form Evans, Shawn:
#!/bin/sh
#
PROC=netscape
NUM=50
CPU=`prstat 1 1 | grep $PROC | awk '{print $9}' |awk -F. '{print $1}'`
#
if [ $CPU -ge $NUM ] ; then
kill -9 `ps -ef | grep -i $PROC`
fi
from Alex J. Avriette:
is there she size of emails"
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:26:15 EDT