Runlevel start/stop scripts
For now I use Red Hat Linux 9. I am trying to understand service start/stop scripts stored in directory /etc/rc.d/init.d.
I see that in the general function script /etc/rc.d/init.d/functions, that functions daemon () and kilproc () which start and stop daemons respectively check for pid files /var/run/programname.pid to find out whether a daemon is already running.
My questions are:
1./ Why the program pidof is not sufficient to use to find out whether a daemon is already running, why the scripts need to check the pid files too?
2./ I still do not understand what is the argument %PPID in the command (notice the percent sign):
pid=`pidof -o $$ -o $PPID -o %PPID -x program`
Thanks for your answer.