How to find process name in c?

Paul Davey pd at ixi.uucp
Tue Jul 17 22:15:30 AEST 1990


In article <570001 at carter.BCASDL.BOEING.COM> lyn at carter.BCASDL.BOEING.COM (     Lyn Stewart      ) writes:

   Has anyone got a method for finding out if a process is running short of
   "ps -ef | grep processname" in a pipe.  There must be a better way from
   within a c program.

Well, for interactive use I use csh aliases, they should be easy enough to
move to (k)sh functions if you don't use csh. I've not needed to solve the
problem strictly or within a program.

This is what I use on sys5 machines,


	alias psg 'ps -ef | sed -n -e "/sed -n -e /d\\
		/\!$/p\\
		/TIME COMMAND/p"'

Everything except the 'ps -ef' is ok on BSD. Change that to 'ps aux'

'psg pd' shows all processes containing the string pd. 


--
 Regards,			 pd at x.co.uk          IXI Limited
	Paul Davey		 pd at ixi.uucp         62-74 Burleigh St.
				 ...!uunet!ixi!pd    Cambridge  U.K.
 "These are interesting times"   +44 223 462 131     CB1  1OJ      



More information about the Comp.unix.wizards mailing list