Sponsored Content
Full Discussion: checking process existed
Operating Systems HP-UX checking process existed Post 302169893 by Frank2004 on Friday 22nd of February 2008 10:03:18 PM
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..
 

10 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

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

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

10. 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
POPEN(3)						     Linux Programmer's Manual							  POPEN(3)

NAME
popen, pclose - process I/O SYNOPSIS
#include <stdio.h> FILE *popen(const char *command, const char *type); int pclose(FILE *stream); DESCRIPTION
The popen() function opens a process by creating a pipe, forking, and invoking the shell. Since a pipe is by definition unidirectional, the type argument may specify only reading or writing, not both; the resulting stream is correspondingly read-only or write-only. The command argument is a pointer to a null-terminated string containing a shell command line. This command is passed to /bin/sh using the -c flag; interpretation, if any, is performed by the shell. The mode argument is a pointer to a null-terminated string which must be either `r' for reading or `w' for writing. The return value from popen() is a normal standard I/O stream in all respects save that it must be closed with pclose() rather than fclose(). Writing to such a stream writes to the standard input of the command; the command's standard output is the same as that of the process that called popen(), unless this is altered by the command itself. Conversely, reading from a ``popened'' stream reads the com- mand's standard output, and the command's standard input is the same as that of the process that called popen. Note that output popen streams are fully buffered by default. The pclose function waits for the associated process to terminate and returns the exit status of the command as returned by wait4. RETURN VALUE
The popen function returns NULL if the fork(2) or pipe(2) calls fail, or if it cannot allocate memory. The pclose function returns -1 if wait4 returns an error, or some other error is detected. ERRORS
The popen function does not set errno if memory allocation fails. If the underlying fork() or pipe() fails, errno is set appropriately. If the mode argument is invalid, and this condition is detected, errno is set to EINVAL. If pclose() cannot obtain the child status, errno is set to ECHILD. CONFORMING TO
POSIX.2 BUGS
Since the standard input of a command opened for reading shares its seek offset with the process that called popen(), if the original process has done a buffered read, the command's input position may not be as expected. Similarly, the output from a command opened for writing may become intermingled with that of the original process. The latter can be avoided by calling fflush(3) before popen. Failure to execute the shell is indistinguishable from the shell's failure to execute command, or an immediate exit of the command. The only hint is an exit status of 127. HISTORY
A popen() and a pclose() function appeared in Version 7 AT&T UNIX. SEE ALSO
fork(2), sh(1), pipe(2), wait4(2), fflush(3), fclose(3), fopen(3), stdio(3), system(3) BSD MANPAGE
1998-05-07 POPEN(3)
All times are GMT -4. The time now is 04:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy