Jan Dvořák mordae at
Wed May 23 16:21:31 PDT 2007

Robert Connolly wrote:
> Is there a shell varable 
> for the pid returned after starting a program?
At least I don't know about any. However, you can use this simple trick 
if the deamon does not fork afterwards;


export deamon='/usr/sbin/exampled'
export pidfile='/var/run/'

sh -c 'echo $$ >"${pidfile}"; exec "${daemon}"' &


This should do the trick.

More information about the hlfs-dev mailing list