How to check for a specific process running or not in Unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to check for a specific process running or not in Unix
# 1  
Old 12-17-2010
How to check for a specific process running or not in Unix

I have used ps -ef | grep <process name> to see if the process is still running or not. But, not being able to find anything in particular. Any clue on this...
# 2  
Old 12-17-2010
Which process u r searching for? Post whatever u have tried.
R0H0N
# 3  
Old 12-17-2010
while running the process create one indicator file in specific path..
after complete checking remove that for next process...
then you can easily know that.
# 4  
Old 12-17-2010
Could you be more specific, please?
# 5  
Old 01-31-2011
First step in your process script is creating an indicator file, let's call it its_running. The last step is removing it, so you get something like this:
#!/usr/bin/sh
touch /tmp/its_running.txt
# Here is your process script
rm /tmp/its_running.txt

As long as the file /tmp/its_running.txt exists your process is running.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with kill a specific process after certain running time

Hi, Do anybody experience to write a bash script in order to kill a specific process (java) after certain time of running? eg. java java.jar task_run.txt I will run a java program (java.jar) which will run a long list of process (task_run.txt) one by one. I plan to terminate the java... (5 Replies)
Discussion started by: perl_beginner
5 Replies

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

3. Shell Programming and Scripting

need to check if the process is running

Hi, I check if the process is running or not using the below. /usr/ucb/ps auxww | grep 109 |grep rmi | awk '{print $2}' 9718 Thus we see 9718 is the PID. It return blank if the process is not running. I need to perform some action if the process is not running and leave it if... (8 Replies)
Discussion started by: shifahim
8 Replies

4. Programming

How do I check if a process is running in C

How to I check if a process is running in C? I'm trying to use ps aux |grep "process name" but failing in doing that. How do I do that? Thanks, (1 Reply)
Discussion started by: cprogdude
1 Replies

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

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

7. Solaris

Check whether ftpd process is running or not?

Hi, I want to check whether the ftpd process is running or not. Is there any solaris command that can help me in this? Or is there any other way in which I can check this? Is it possible to check programmatically (preferrably in a C++ code)? Eagerly awaiting a reply. Thanx. (8 Replies)
Discussion started by: The.White.Rider
8 Replies

8. Shell Programming and Scripting

check process running

I have this script: ------------------------------------------------------- #!/bin/ksh # if ] || ] then echo "Executing main_load.sh script" /usr1/psc_load/jobs/cron/main_load.sh "ods" else echo "File not found, do nothing" fi exit 0 ... (4 Replies)
Discussion started by: rose1207
4 Replies

9. Shell Programming and Scripting

How to check for specific process running through shell

Hi I want to check whether specific process is running or not through a shell script. ps -ef | grep will tell me this, i tried this way in shell cnt =`ps -ef| grep xyz | awk '{ END {print NR}}` if it return two rows, job is running else not. Is there any better way of doing this. (3 Replies)
Discussion started by: agp
3 Replies

10. Shell Programming and Scripting

How to check if another instance of the process is running

Hi, I am writing a shell script to invoke a C++ program. Before I start the C++ program (oi7loadbalancer), I am checking if the process is already running. I start the process only if it is not already running. I have the following check in my script. proccount=`ps -f -u $USER_NAME | grep... (8 Replies)
Discussion started by: sim
8 Replies
Login or Register to Ask a Question