Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Check whether a process is alive or not Post 302119636 by radoulov on Thursday 31st of May 2007 06:04:56 AM
Old 05-31-2007
Quote:
Originally Posted by appleforme1415
[...]
Basically i have Process ID of background process which is running currently.
I want to check whether the process that belongs to the process id is alive or not .....
[...]
Code:
$ sleep 5 &
[1] 24814
$ ps -p $! || echo "not running"
   PID TTY      TIME CMD
 24814 pts/1    0:00 sleep
$ 
[1]+  Done                    sleep 5
$ ps -p $! || echo "not running"
   PID TTY      TIME CMD
not running

If your ps doesn't support the p option, use "...|grep <pid>"
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

check if job still alive and killing it after a certain walltime

Hi! I'm using a script to start a process that might run forever if some parameters are given wrong (it's part of an optimization). I would now like to have the process killed after a certain walltime in that case. So far I get it done with the following lines ./My_process.e & pid=`ps -ef |... (3 Replies)
Discussion started by: ciwstevie
3 Replies

2. UNIX for Advanced & Expert Users

Check the process

I want to find the pid ( by ps ) that has already run over 30 seconds , I know ps only show the minute/hour . eg. the start time of the below process are 15:19 / 15:20 , but I don't know the exact time ( in term of "second" ) it start to run ( I only know the hour and minute ) , if I want to... (2 Replies)
Discussion started by: ust
2 Replies

3. Shell Programming and Scripting

check the process

how to kill the process that are idle over 30 minutes ? thx (2 Replies)
Discussion started by: ust
2 Replies

4. UNIX for Dummies Questions & Answers

Check the process

Except the command "top" , is there other function / tool is used to check the process status in the system like 1. what process are running ? 2. how the CPU are allocating ? 3. how many swap is using ? 4. " Thx. (1 Reply)
Discussion started by: ust
1 Replies

5. Shell Programming and Scripting

How to check if a pid is alive?

I want to do some operations provided the pid is active. (6 Replies)
Discussion started by: ScriptDummy
6 Replies

6. Shell Programming and Scripting

Check process

Hi.. I have this code which tells me that if a process is running or not. Actually someone on this forum help me to do it. :) But now If i want to check if the process is not running for more than 10 minutes. Does anyone know the code or syntax that checks if a process is not running for some... (1 Reply)
Discussion started by: kanexxx
1 Replies

7. Solaris

keeping a process alive ?

Hello guys, I have one script running that I need to keep it running 24x7 so I'd like to know how can I implement a sort of monitoring process I mean if for some reason this process dies somehow it gets automatically started again. Thanks. (8 Replies)
Discussion started by: cerioni
8 Replies

8. UNIX for Dummies Questions & Answers

Check the URL is alive or dead with port number

Hi, I am running certain weblogic instance, in which it's hard to find which instance is stopped or running after stopping the weblogic , cause process status is for all the instance is same. A URL which shows the instance is stopped or running. But i have major challenge to check it through... (2 Replies)
Discussion started by: posix
2 Replies

9. UNIX for Dummies Questions & Answers

How a process can check if a particular process is running on different machine?

I have process1 running on one machine and generating some log file. Now another process which can be launched on any machine wants to know if process1 is running or not and also in case it is running it wants to stream the logs file generated by process1 on terminal from which process2 is... (2 Replies)
Discussion started by: saurabhnsit2001
2 Replies

10. Tips and Tutorials

My "Bread and Butter" Process Keep Alive Perl Script....

For the newbies, I should have posted this years ago.... Here is the standard (tiny) "bread and butter" perl script (on Linux) I use in my crontab files to insure key processes are alive ( just in case ! ) like httpd, named, sshd, etc. The example below if for named...... ... (1 Reply)
Discussion started by: Neo
1 Replies
OPAL-CHECKPOINT(1)						       1.4.5							OPAL-CHECKPOINT(1)

NAME
opal-checkpoint - Checkpoint a running sequential process using the Open PAL Checkpoint/Restart Service (CRS). Note: This should only be used by the user if the application being checkpointed is an OPAL-only application. If it is an Open RTE or Open MPI program their respective tools should be used. SYNOPSIS
opal-checkpoint [ options ] <PID> Options opal-checkpoint will attempt to notify a running process that it has been requested that the process checkpoint itself. A snapshot handle reference is presented to the user, which is used in opal_restart to restart the process. <PID> Process ID of the running target process. -h | --help Display help for this command --term After checkpointing the running process, terminate it. -v | --verbose Enable verbose output for debugging. -n | --name Request a specific name for the local snapshot reference. -w | --where Request that the local snapshot reference be placed in a specific location. -gmca | --gmca <key> <value> Pass global MCA parameters that are applicable to all contexts. <key> is the parameter name; <value> is the parameter value. -mca | --mca <key> <value> Send arguments to various MCA modules. DESCRIPTION
opal-checkpoint can be invoked multiple, non-overlapping times. This allows the user to take involuntary checkpoints of a running sequen- tial process. See opal_crs(7) for more information about the CRS framework and components. It is convenient to note that the user does not need to spectify the checkpointer to be used here, as that is determined completely by the running process being checkpointed. SEE ALSO
opal-restart(1), opal_crs(7) Open MPI Feb 10, 2012 OPAL-CHECKPOINT(1)
All times are GMT -4. The time now is 01:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy