From owner-freebsd-questions@FreeBSD.ORG Tue Oct 5 11:18:49 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D8CA106564A for ; Tue, 5 Oct 2010 11:18:49 +0000 (UTC) (envelope-from emss.mail@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id E56548FC0C for ; Tue, 5 Oct 2010 11:18:48 +0000 (UTC) Received: by wwb17 with SMTP id 17so8024244wwb.31 for ; Tue, 05 Oct 2010 04:18:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received :x-virus-scanned:received:received:to:subject:from :x-operating-system:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=FoJgR1Yn4boUfbgA6mO0sUlNvFgAWixFxzBF3h8krD8=; b=MM13ICs8JW8fyqChCf8Qha4sBFD1HK2ntoJPOErl2Q7bDq4440Ii1j+ce+UZ4qYJqg cODdQOds1FfgsGsdcBGKB9xnae9SdDkDdertQl+krjEnZ1UR2V7DI0772G42+j+v2xMc zwqt2q0h1SI9ztYuyCpSZ2cIoxY7nxpjEBURo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:x-virus-scanned:to:subject:from:x-operating-system:date :message-id:user-agent:mime-version:content-type :content-transfer-encoding; b=jb/Xq1Ro8G4zSTfFLt8/9kjIQGZI/j7tVmlFncxUOlhx3m66+oyj6++Z0zxds9Lw8w l6d2fD7CxgJ8eFSpRwHY+9267Uhc4reiXYB4wQXyielcsw/XOjCq23hMhxvQAK9LdIvE z/BDKx4n/SvO0+Q3HJ83xgtNXMKhXP3tDhP7Y= Received: by 10.216.236.149 with SMTP id w21mr9003793weq.65.1286277527463; Tue, 05 Oct 2010 04:18:47 -0700 (PDT) Received: from srvbsdfenssv.interne.associated-bears.org (LCaen-151-92-21-48.w217-128.abo.wanadoo.fr [217.128.200.48]) by mx.google.com with ESMTPS id b10sm3805729wer.41.2010.10.05.04.18.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 05 Oct 2010 04:18:44 -0700 (PDT) Sender: Eric Masson Received: from srvbsdfenssv.interne.associated-bears.org (localhost [127.0.0.1]) by srvbsdfenssv.interne.associated-bears.org (Postfix) with ESMTP id 0BB4F1D27C for ; Tue, 5 Oct 2010 13:18:42 +0200 (CEST) X-Virus-Scanned: amavisd-new at interne.associated-bears.org Received: from srvbsdfenssv.interne.associated-bears.org ([127.0.0.1]) by srvbsdfenssv.interne.associated-bears.org (srvbsdfenssv.interne.associated-bears.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2PP-ZqzEze-j for ; Tue, 5 Oct 2010 13:18:38 +0200 (CEST) Received: by srvbsdfenssv.interne.associated-bears.org (Postfix, from userid 1001) id B9B1C1CDAB; Tue, 5 Oct 2010 13:18:38 +0200 (CEST) To: FreeBSD Questions From: Eric Masson X-Operating-System: FreeBSD 8.1-RELEASE-p1 amd64 Date: Tue, 05 Oct 2010 13:18:38 +0200 Message-ID: <86d3ronb01.fsf@srvbsdfenssv.interne.associated-bears.org> User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.5-b28 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Cc: Subject: Custom rc script using /usr/sbin/daemon X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2010 11:18:49 -0000 Hello, I'm trying to create a script that would launch php-cgi in fastcgi mode. So far, I've the following script : #!/bin/sh # # PROVIDE: phpfastcgi # REQUIRE: DAEMON # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable phpfastcgi : # # phpfastcgi_enable (bool): Set it to "YES" to enable phpfastcgi # Default is "NO". # phpfastcgi_flags (str): Set the uwsgi command line arguments # Default is "-M -L". . /etc/rc.subr name="phpfastcgi" rcvar=`set_rcvar` [ -z "$phpfastcgi_enable" ] && phpfastcgi_enable="NO" [ -z "$phpfastcgi_flags" ] && phpfastcgi_flags="" load_rc_config $name sig_stop="TERM" pidfile="/var/run/${name}/${name}.pid" command="/usr/sbin/daemon -f -p ${pidfile} /usr/local/bin/php-cgi" run_rc_command "$1" When invoked with start argument, it barfs at me but launches php-cgi as expected : emss@srvbsdfenssv:~> sudo /usr/local/etc/rc.d/phpfastcgi start /usr/local/etc/rc.d/phpfastcgi: WARNING: no shebang line in /usr/sbin/daemon [: /usr/sbin/daemon: unexpected operator Starting phpfastcgi. When invoked with stop argument, it errors and doesn't stop the process as expected : emss@srvbsdfenssv:~> sudo /usr/local/etc/rc.d/phpfastcgi stop /usr/local/etc/rc.d/phpfastcgi: WARNING: no shebang line in /usr/sbin/daemon phpfastcgi not running? (check /var/run/phpfastcgi/phpfastcgi.pid). >From a quick peek at /etc/rc.subr, it seems that messages regarding lack of shebang line in /usr/sbin/daemon indicate something is wrong in my script but atm, I can't figure it. Any idea, anyone ? Kind Regards Éric Masson -- RJ> j'ai eu des cookies sur mon HD et j'ai un peu peur des représailles Il faut reformater ton disque dur et le jetter depuis le 3e étage de la tour Eiffel pour le détruire irrémédiablement sans laisser de traces. -+- LP in : Par ici ou parano c'est pareil -+-