process check


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers process check
# 8  
Old 06-17-2005
Quote:
Originally Posted by k@ssidy
I can't seem to get a grasp on the fuser option either but I am still giving it a try in a copy of my script
why don't you try it in a standalone script as suggested and see what happens...
# 9  
Old 06-17-2005
the fuser script works, sort of, I put it into my script, I start one instance of the program and it appears to work fine but it never finishes, it just hangs on the last step of the prog, if I start another process while that one is running, the fuser script surely tells me one is already in progress and kicks me out, can you think of anything in the fuser script that may be causing the hang up?
# 10  
Old 06-17-2005
sounds like it's got nothing to do with the 'fuser' logic, but rather with the rest of the script.
# 11  
Old 06-17-2005
Can you post your script?
# 12  
Old 06-17-2005
Create a lock file

May be you could try this :

You could create a temporary zero byte lockfile and check for its existence every time before you run the script.If the file exists you can give a sleep command to wait for some time before checking again or exit.
You could remove this file just before your script ends its execution.

regards,
Srikanth
# 13  
Old 06-17-2005
yes, that was the easiest way to accomplish this task, I created a file when my script began processing and removed it before the script exited, then I just put a check in to see if the file was created or not, that was a very simple approach, thank you. fyi, the fuser script also worked fine, apparently the problem was with the database I was accessing and not my script or the fuser program. I will keep that on the side as it is ver specific to process info and could be very useful. Thanks for all your help!
# 14  
Old 06-17-2005
Quote:
Originally Posted by k@ssidy
yes, that was the easiest way to accomplish this task, I created a file when my script began processing and removed it before the script exited, then I just put a check in to see if the file was created or not, that was a very simple approach, thank you. fyi, the fuser script also worked fine, apparently the problem was with the database I was accessing and not my script or the fuser program. I will keep that on the side as it is ver specific to process info and could be very useful. Thanks for all your help!
If you are using a touch file, you should make sure you have an appropriate trap for signals to make sure that file is removed if it ended by a signal, otherwise you may end up with a script which does not run as you want.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

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

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

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

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

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

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

10. 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
Login or Register to Ask a Question