how to check whether a script is running actively or hanged/ in deadlock)


 
Thread Tools Search this Thread
Operating Systems HP-UX how to check whether a script is running actively or hanged/ in deadlock)
# 1  
Old 11-22-2005
how to check whether a script is running actively or hanged(in deadlock)

Hi
I have a doubt regarding process states in HP unix system. Is there a way to check whether a process is hanged or still actively running? I have few scripts which run for a long time. but sometimes these are getting hanged. But i'm never sure whether they are running or waiting in kind of deadlock. these process are present when i check using "ps -ef" command.
Is there any way to tail the output of a process that has already started? i've asked this because we can know whether it's hanged or running.

Last edited by truth; 11-22-2005 at 07:27 AM..
# 2  
Old 11-22-2005
You can run the script with set -x or with ksh -x options and redirect the stderr to some file. This will echo each statement into that file when it is run. Then you can check that file and know exactly what exactly your script is doing.
# 3  
Old 11-22-2005
another tool on HPUX is "truss"...

truss -p activePROCid
or
truss initiatingJOB
# 4  
Old 11-23-2005
Thanks blowtorch. I tried as u have said. It is working when i'm executing from the command prompt. But when the cronjob runs this process, where will it output the text to if we don't specify any outpath ? I've given the option set -x at the beginning of file without any path for o/p file.
# 5  
Old 11-23-2005
When you run a script with 'set -x' options, it is run in debug mode, where each command is printed in the terminal window before it is executed. When a script runs through cron, there are no terminals involved, so you wouldn't get any output unless you redirect the stderr to some file.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to check if the script is already running?

I have one shell script in NAS shared location. Since NAS is mounted in many servers, script can be run from any of those servers. I want to make sure if the script is already running, it should not allow others to run it. I googled it and got some idea that i can touch one empty file in the... (8 Replies)
Discussion started by: thomasraj87
8 Replies

2. Shell Programming and Scripting

Check to see if script is already running

Happy New Year Is there a quick way to check to see if a script is already running. I want to put in a check in the script to exit, if already running. Currerntly i can only think of doing it the following way. # ps -ef | grep -i 3_HOUSEKEEPING_FFTVTL_TO_FFTDSSU_DUPLICATION.ksh |... (5 Replies)
Discussion started by: Junes
5 Replies

3. Linux

Check up the status of a Script (running or not)

Hello, i allready search on google und here in the local Forum, but can't found something. I need a query in php, that check whether a process (script) is running or not. Like this: php query: /usr/bin/Script01 >> if runnig, then: "Script01 is Online", if not "Script01 is Offline" I... (2 Replies)
Discussion started by: ProTechEx
2 Replies

4. Shell Programming and Scripting

script to check if another script is running and if so, then sleep for sometime and check again

Hi, I am a unix newbie. I need to write a script to check wheteher another script is still running. If it is, then sleep for 30m and then check again if the script is running. If the script has stopped running then, I need to come out of the loop. I am using RHEL 5.2 (2 Replies)
Discussion started by: mathews
2 Replies

5. Shell Programming and Scripting

script to check if process is running

How do I make a shell script to see if a certain process is running. The process shows up on ps aux as /usr/sbin/daemon eg: if /usr/sbin/daemon else #nothin basically i want to run the process if it isnt running/ has been stopped. Thanks. (2 Replies)
Discussion started by: daydreamer
2 Replies

6. UNIX for Dummies Questions & Answers

check user id before running script

I am looking for the syntax to check which ID is executing script.sh. If the the ID, is not user1 then I want the script to exit and return to command prompt, if it is user1, then I want the script to continue. Any help would be greatly appreciate. Thank you. Chris (3 Replies)
Discussion started by: cpolikowsky
3 Replies

7. Shell Programming and Scripting

Running a check platform script

Hi, I want to run a check platform & application script under ksh (Soaris boxes). It runs some commands and it take some time. I want to customize it like that: - output is too big, hence I want some output of the commands to be redirect ed in an output file (or maybe two or three) - not... (4 Replies)
Discussion started by: heartwork
4 Replies

8. Shell Programming and Scripting

Check if trigger Script is running

HI, I have a script which will be running all the time...it is like a trigger.. wakesup every 10 minutes(trigger.sh) executes, and I want to write another script which monitors this script every one hour and if it finds that trigger script is not running it should start it and exit...and here... (9 Replies)
Discussion started by: mgirinath
9 Replies

9. Shell Programming and Scripting

Actively watching for running processes

Here's a fun one... What's the best way to script looking for a process when it runs? For example, what if a process is running that's been set up graphically, which you would like the entire command line string for? Say it's rpm for the sake of having a command to use as an example. You want... (2 Replies)
Discussion started by: sysera
2 Replies

10. Shell Programming and Scripting

check that script is not running twice

using ps -ef | fgrep "ld_data" how do i write a script to check that it didn't already run Thanks (2 Replies)
Discussion started by: Link_02
2 Replies
Login or Register to Ask a Question