The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Operating Systems > HP-UX
.
google unix.com



HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
script to monitor process running on server and posting a mail if any process is dead pradeepmacha Shell Programming and Scripting 13 03-06-2009 07:33 AM
Killing of a process and send a mail if the process doesnot come up within 2 minutes Prince89 Shell Programming and Scripting 1 02-15-2008 07:10 PM
how to start a process and make it sleep for 5 mins and then kill that process shrao Shell Programming and Scripting 6 03-27-2007 01:54 PM
Removing the only secodnary group existed from a user on SUN or HP jquizon62 SUN Solaris 1 01-10-2006 05:17 PM
checking for a running process from korn cron jph Shell Programming and Scripting 2 05-01-2005 01:27 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-22-2008
Frank2004 Frank2004 is offline
Registered User
  
 

Join Date: Jun 2004
Location: Beijing, China
Posts: 54
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 (permalink)  
Old 02-23-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,800
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 (permalink)  
Old 02-25-2008
Frank2004 Frank2004 is offline
Registered User
  
 

Join Date: Jun 2004
Location: Beijing, China
Posts: 54
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 (permalink)  
Old 02-25-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,800
Which file are you talking about? Can you give an example?
  #5 (permalink)  
Old 02-25-2008
Frank2004 Frank2004 is offline
Registered User
  
 

Join Date: Jun 2004
Location: Beijing, China
Posts: 54
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 (permalink)  
Old 02-26-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,800
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0