[arch-general] get pid of daemon in init script

Travis Willard travis at archlinux.org
Fri Feb 8 15:11:49 EST 2008


On Feb 8, 2008 3:06 PM, Sentinel <kanocz at intrak.sk> wrote:
> Hi!
>
> It works perfectly (at least for me), just you have to ensure, that you
> call it with appropriate rights while testing:
> my testing:
> sentinel at sentinel:~$ su
> Password:
> with power comes great responsibility
> root at sentinel:/home/sentinel# PID=`pidof -o %PPID -x /usr/sbin/proftpd`
> root at sentinel:/home/sentinel# echo $PID
> 7469
> root at sentinel:/home/sentinel# [ -z "$PID" ] && echo "pid is empty"
> root at sentinel:/home/sentinel#
>
> Tom

That is because you already have /usr/sbin/proftpd running.  In the
case of running the start initscript, the PID is sampled before the
application ever starts, and hence will return no PID, as Dan already
explained.




More information about the arch-general mailing list