Re: get pid of daemon in init script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



yes you are right.

root@sentinel:/home/sentinel# /etc/rc.d/proftpd stop
:: Stopping ProFTPd Server [DONE]
root@sentinel:/home/sentinel# PID=`pidof -o %PPID -x /usr/sbin/proftpd`
root@sentinel:/home/sentinel# echo $PID

root@sentinel:/home/sentinel#

Sorry, I made a mistake. I usually do not have my ftp server running. But I forgot, that I was moving something between my computer and laptop. :)

Btw proftpd's init script does the same. The proftpd.pid file is empty.

T

Travis Willard wrote:
On Feb 8, 2008 3:06 PM, Sentinel <kanocz@xxxxxxxxx> 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@sentinel:~$ su
Password:
with power comes great responsibility
root@sentinel:/home/sentinel# PID=`pidof -o %PPID -x /usr/sbin/proftpd`
root@sentinel:/home/sentinel# echo $PID
7469
root@sentinel:/home/sentinel# [ -z "$PID" ] && echo "pid is empty"
root@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.





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux