checking process existed


 
Thread Tools Search this Thread
Operating Systems HP-UX checking process existed
# 1  
Old 02-22-2008
checking process existed

On HP-UX, in application, if the process id has been get with the getpid() and sotred in database, then other monitor process want to check it if the process is existed, are there any system function can do it? I do not want to use the shell script, because it should use popen function to excuted and get the return, popen manupulate the pipe from process, it sometimes cause much I/O.

Last edited by Frank2004; 02-22-2008 at 11:17 PM..
# 2  
Old 02-23-2008
try man utmp or man wtmp.

The files record system activity, the man pages document calls to read the files directly.
No popen needed.
# 3  
Old 02-25-2008
Thanks, I'll try it.
Here is another question:
On HP-UX, how the file with the # character at the beginning generate and how to avod it?
# 4  
Old 02-25-2008
Which file are you talking about? Can you give an example?
# 5  
Old 02-25-2008
The filename preceded with pound sign (#), such as:
#hosts,#ntp.conf, #myprog, etc.

Once the opendir() or readdir() encounters the above format filename, the operation exit and can not look through the directory normmally. we want to void it.
# 6  
Old 02-26-2008
You can use ftw() or nftw(). Those require you to define a callback function that decides whether or not to continue.

I also don't see why readdir would exit, do you check return codes from opendir() and readdir() when this occurs? If you are using system() to do something, the shell being run in the system call will treat the '#' as a comment, rather than a file name.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Checking DataPump Process

Hi All, I am writing script for Env refresh for Oracle DB. I am using Datapump for that. If i start expdp or impdp, how can i know that export or import has completed. I have query for that. How will i integrate with script?. Or any command i can run from Linux side. Please share you... (1 Reply)
Discussion started by: pvmanikandan
1 Replies

2. Shell Programming and Scripting

Problem with a script for checking the state of a process

Hello Everyone, I have a process that should be always running. Unfortunately, this process is getting down almost every 10 minutes. I want to make a script that verify the state of this process: If the process is up, the script shouldn't do nothing and if it's down he should run it. Can... (3 Replies)
Discussion started by: adilyos
3 Replies

3. Shell Programming and Scripting

My Script For Process Checking is NOT Working

Hello there ULF, Good day! Just want to share my code and as well as my problem on why I'm not getting the output that I want. My original code was: #!/usr/bin/sh echo echo -n "Please input an IP-Pool: " read ip echo echo "Please wait....."... (8 Replies)
Discussion started by: rymnd_12345
8 Replies

4. Shell Programming and Scripting

block process checking

How can i check block process in Linux? If found any what action is required? How to check the pid of process? How to kill the block process? How to find out bottleneck process? (3 Replies)
Discussion started by: learnbash
3 Replies

5. Shell Programming and Scripting

Process checking loop

Hi, I want to create a script who will check if the java process is running & if it finds the process is still there it continues to execute & when the process completes it exit from the script. I have written a code to check & notify the process existence but i am not getting how to write... (4 Replies)
Discussion started by: d8011
4 Replies

6. Shell Programming and Scripting

checking file whether existed in another server or not

need a shell script in unix to check whether a file is existed in dir after connecting using ftp (2 Replies)
Discussion started by: KiranKumarKarre
2 Replies

7. Shell Programming and Scripting

checking file whether existed in another server or not

Hi, i am in 272.22.22.32 server, and i want to check whether a file test.txt file exists in different server like 372.23.23.23 using shell script. can any one help me out. (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

8. Shell Programming and Scripting

Checking for multiple instances of a process

Hi I have a scenario where i need to check multiple instances of a running shell script (abc.sh) . How can I find from inside a running shell script whether any other instance of the same script is running or not? If any other instance of same shell script is running I need to exit from... (4 Replies)
Discussion started by: raghu.amilineni
4 Replies

9. Shell Programming and Scripting

Checking the cron process in unix

Hi Experts, Is there any command by which i can chk that the cron process is running fine? Say i have scheduled the cron to run at 10 o clock every monday,Do i need to wait for the time it runs and then chk using ps -ef? Please shed some light. Thanks Ashok. (2 Replies)
Discussion started by: Ashok_oct22
2 Replies

10. Shell Programming and Scripting

checking for a running process from korn cron

cron starts a job every 10 minutes via a korn shell - I need to determine if the previous process is still running before I allow the new process to start - HELP I've tried ps -ef, etc but I have seen many situation where it says that the is running when it is not - any ideas on how to absolutely... (2 Replies)
Discussion started by: jph
2 Replies
Login or Register to Ask a Question