- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script that kills ghost processes
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
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
тАО03-22-2005 05:59 AM
тАО03-22-2005 05:59 AM
script that kills ghost processes
we have a system thats been running acucobol and oracle for about 7 yrs. sometimes when the users get ancy they shutdown their pcs and leave ghosts running taking cpu time. we have this script that runs and kills them, but i noticed that the first part(processlist, userlist) doesnt work, the second part does.
any ideas?
thx in advance
# The purpose of this script is to clean up orphan processes.
# Exclusions are implemented by the "grep -v" command.
#
set -o xtrace
date
cd /util
# This loop generates a list of users, then generates a list of processes
# associated with each users id. If the terminal is a "?" it kills them.
#USERLIST
for user in `/usr/bin/ps -ft? | /usr/bin/grep "\-sh" | \
/usr/bin/grep -v root |/usr/bin/grep -v oracle|/usr/bin/grep -v ora
_|/usr/bin/grep -v ftpmat |/usr/bin/grep -v ftplaw|/usr/bin/grep -v lawcron|/usr
/bin/grep -v snamat|awk '{print $1}`
do
#PROCESSLIST
/usr/bin/ps -fu $user | /usr/bin/grep -v PID | \
/usr/bin/awk '{if ($6 == "?") {print $2}}' | \
/usr/bin/xargs -n1 kill 2>>/dev/null
done
# This loop picks up child processes that have that have lost their parent
# user processes. It is repeated for throughness.
for proc in `ps -ft "?" | grep -v ftpmat |grep -v root|grep -v oracle|grep -v or
a_| grep -v snamat | grep -v lawcron | grep -v fptlaw | grep -e runwcis -e runcm
s -e runplis -e runctms | awk '{print $2}'`
do
ps -ef | grep " "$proc" " | grep -v grep | awk '{print $2}' | \
sort -r | xargs -n 1 kill
done
sleep 5
for proc in `ps -ft "?" | grep -v ftpmat |grep -v root|grep -v oracle|grep -v or
a_| grep -v snamat | grep -v lawcron | grep -v ftplaw | grep -e runwcis -e runcm
s -e runplis -e runctms | awk '{print $2}'`
do
ps -ef | grep " "$proc" " | grep -v grep | awk '{print $2}' | \
sort -r | xargs -n 1 kill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-22-2005 06:05 AM
тАО03-22-2005 06:05 AM
Re: script that kills ghost processes
The close the app instead of logging out and the process remains for 30 minutes until timeout.
You are moving in the right direction, but take care to distinguish live oracle sessions from orphan ones.
User training can help with this too.
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
тАО03-22-2005 06:21 AM
тАО03-22-2005 06:21 AM
Re: script that kills ghost processes
Aren't ghosts already dead? It's like Night of the Living Dead - You kill them and they just keep coming back.
My idea, and it worked in a lot of banks: remove the users keyboard and make them sign it back out from the VP. See how long it takes them to remember to gracefully shutdown their applications!!!
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-22-2005 07:03 AM
тАО03-22-2005 07:03 AM
Re: script that kills ghost processes
any other ideas, thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-22-2005 08:16 PM
тАО03-22-2005 08:16 PM
Re: script that kills ghost processes
----- starts code
for user in `/usr/bin/ps -ft? | \
/usr/bin/grep "\-sh" | \
/usr/bin/grep -v root | \
/usr/bin/grep -v oracle | \
/usr/bin/grep -v ora_ | \
/usr/bin/grep -v ftpmat | \
/usr/bin/grep -v ftplaw | \
/usr/bin/grep -v lawcron | \
/usr/bin/grep -v snamat | \
awk '{print $1}'`
do
/usr/bin/ps -ft? -u $user | /usr/bin/grep -v PID | /usr/bin/awk '{print $2}' | /usr/bin/xargs kill
done
----- ends code
Some few points to discuss :
. If a user have two sessions and one has no terminal, your procedure will kill his two sessions
. there's a missing ' before the last ` but it doesn't seem to be a problem :)
Regards,
Fred
"Reality is just a point of view." (P. K. D.)