Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Oct 2010 14:11:58 +0100
From:      RW <rwmaillists@googlemail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Custom rc script using /usr/sbin/daemon
Message-ID:  <20101005141158.4730dab3@gumby.homeunix.com>
In-Reply-To: <86d3ronb01.fsf@srvbsdfenssv.interne.associated-bears.org>
References:  <86d3ronb01.fsf@srvbsdfenssv.interne.associated-bears.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 05 Oct 2010 13:18:38 +0200
Eric Masson <emss@free.fr> wrote:

> Hello,
> 
> I'm trying to create a script that would launch php-cgi in fastcgi
> mode. So far, I've the following script :
> 
>...
>
> sig_stop="TERM"
> pidfile="/var/run/${name}/${name}.pid"
> command="/usr/sbin/daemon -f -p ${pidfile} /usr/local/bin/php-cgi"

I don't think you can do it like that. IIRC when you try to stop a
daemon it doesn't just kill the process by pid, it also sanity checks
the command in case the daemon has died and the pid was reused.
Since "daemon" wont show-up in the ps output it can't be in the command
variable.

I think you need to write a start function, something like this:


start_cmd="phpfastcgi_start"
command="/usr/local/bin/php-cgi"

phpfastcgi_start(){  
    echo "starting phpfastcgi."
   /usr/sbin/daemon -f -p ${pidfile} ${command}
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101005141158.4730dab3>