Check process


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Check process
# 1  
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. Smilie 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 amount of time? Please help me.

Code:
#!/bin/bash
#check_procs returns "OK:  process running" if the process is running and "not running: process not running"
 
check=$"/usr/local/check_procs myprocess"
var="not runnig: myprocess not running"
 
if [ $check = $var ]; then 
   echo "not running"
else 
  echo "runnig"
fi

Thanks

Last edited by Yogesh Sawant; 04-20-2009 at 08:14 AM.. Reason: added code tags
# 2  
Try to call this script in some timer every once in a while and see if the process in running or not and get the timestamp( ) whenever you check.. the difference should get you the time whether the process was running or not...
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #931
Difficulty: Medium
64-bit computer system storage allocation for timekeeping will allow them to represent dates more than 300 billion years into the future.
True or False?

10 More Discussions You Might Find Interesting

1. 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

2. UNIX and Linux Applications

How to check if process is running?

Hi I would like to check if an instance of a script is already running. I've seen many different examples, but I haven't the slightest idea as to how to do this. Can you please help. Thank you. (5 Replies)
Discussion started by: ladyAnne
5 Replies

3. Shell Programming and Scripting

Check if Process is running

Hi , I have a csh code below which check the process if it's running. Can any expert advise me on the following: 1) what does this notationmean ">!" and how is it different from the append ">" notation ? 2) how does "setenv" work in this code ? # Check whether there is a running... (3 Replies)
Discussion started by: Raynon
3 Replies

4. Solaris

Check CRON Process

How to find what are the cron jobs which are running at any instant on a Solaris server ??? The job can be scheduled from any id but still would like to list all the cron jobs which are running on the server ??? (2 Replies)
Discussion started by: helper
2 Replies

5. UNIX for Dummies Questions & Answers

Check whether a process is alive or not

Hi Everybody I have small requirement that needs to be implemented in shell script. Currently i have shell script which invokes a java process say "Process A" which runs in background. If some one tries to invoke again the same shell script , then there should be some mechanism inside the... (23 Replies)
Discussion started by: appleforme1415
23 Replies

6. 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

7. 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

8. 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

9. UNIX for Advanced & Expert Users

How to check Process Utilisation

Hi, Is there any way in Unix to check for the system usage processwise ?? I mean I wud like to get a listing of running processes along with their CPU / memory utilisation so that I can spot dangerous the space / memory eaters .. Thanks & regards, SNS (2 Replies)
Discussion started by: Sabari Nath S
2 Replies

10. UNIX for Dummies Questions & Answers

process check

does anyone know an easy way that at the beginning of your script you check to see if that process is already running? I think it would have something to do with ps but I may be making it more complicated than it has to be. If you have a script run say, every half hour, you would want to check and... (13 Replies)
Discussion started by: k@ssidy
13 Replies

Featured Tech Videos