![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| zombie processes and hung process termination | ukndoit | Shell Programming and Scripting | 2 | 03-14-2008 02:53 AM |
| Monitoring Processes - Killing hung processes | ukndoit | UNIX for Advanced & Expert Users | 4 | 01-17-2008 04:30 AM |
| process monitoring | eric_wong_ch | Shell Programming and Scripting | 3 | 10-11-2007 06:08 AM |
| SCO Openserver 5.0.7 Hung process problem | josramon | UNIX for Dummies Questions & Answers | 0 | 04-25-2006 04:51 PM |
| Monitoring ftp process | arkhewit | UNIX for Dummies Questions & Answers | 2 | 06-29-2005 06:56 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Monitoring for a hung process
A coworker has a shell script that runs from a scheduler at the 3am. The shell script runs sqlplus passing in a sql statement, which generate a file. This is done 21 times for 21 different sql statements. Recently, one of the sqlplus processes got hung.
Is there a way to monitor how long the shell script takes to run, and kill it if it takes longer than, lets say, an hour. Or to monitor the time the individual sql's run? |
|
||||
|
Assuming you can't spawn these off to separate shells where you would:
thatprog & $progid=$! sleep $sleeptime kill $progid But if you need to be doing other stuff in between, generally you'd capture the PID's of the processes when they start, then watch for those processes still running ("ps -p $pid" if you are using shell), killing them when your conditions dictate. You might also be able to use "ulimit -t" to set maximum cpu time used if that makes sense. -- Tony Lawrence Unix, Linux, Mac OS X Help, Tutorials and support pages |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|