From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1216 Path: news.gmane.org!not-for-mail From: "Wayne Marshall" Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Daemontools run script Date: 2 Aug 2006 09:59:01 -0700 Organization: guinix international Message-ID: <20060802095901.3a1d0862@alloy.copperisle.com> References: <032F7A897DBD0E4EAA8F57DCFBAE979F16FFFC@ukplc01.internal.calleva.ukplc.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1154537317 2537 80.91.229.2 (2 Aug 2006 16:48:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 2 Aug 2006 16:48:37 +0000 (UTC) Original-X-From: supervision-return-1452-gcsg-supervision=m.gmane.org@list.skarnet.org Wed Aug 02 18:48:29 2006 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1G8Jsp-0007uO-9p for gcsg-supervision@gmane.org; Wed, 02 Aug 2006 18:47:47 +0200 Original-Received: (qmail 9540 invoked by uid 76); 2 Aug 2006 16:48:08 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 9534 invoked from network); 2 Aug 2006 16:48:08 -0000 Original-To: supervision@list.skarnet.org In-Reply-To: <032F7A897DBD0E4EAA8F57DCFBAE979F16FFFC@ukplc01.internal.calleva.ukplc.net> X-Mailer: Sylpheed-Claws 2.3.1 (GTK+ 2.6.10; i686-pc-linux-gnu) Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1216 Archived-At: On Wed, 2 Aug 2006 10:07:28 +0100 "ed neville" wrote: > > Here is an alternative vsftpd script without using tcpserver, in > theory a little more efficient as a new cop of vsftpd is not forked > on all connections > > #!/bin/sh > > exec 2>&1 > > PF="/var/run/vsftpd/vsftpd.pid"; > VSB="/usr/sbin/vsftpd"; > > while [ true ] ; > do > PID=$( cat $PF ); > CMD=$( cat /proc/$PID/cmdline 2>&1 ); > if [ "$CMD" != "$VSB" ] ; > then > echo "$VSB not running" ; > /etc/init.d/vsftpd stop > /etc/init.d/vsftpd start > fi ; > sleep 5; > done ; > > This script indicates some (rather massive) confusion about what it means to run a service under supervision. All you really want here is this: #!/bin/sh exec 2>&1 exec /usr/sbin/vsftpd #EOF Set up your vstpd.conf file with 'background=NO' and 'listen=YES' and no other run script gymnastics. The service supervisor will keep track of the PID for you, and will automatically notice if the service dies, in which case it will try to restart it. You will manage the service directly with svc/sv to start/stop/restart/etc, and none of the slag from /etc/init.d. As for not using tcpserver/tcpsvd, that's up to you, but for an ftp service it is probably not worth the loss of the concurrency limits and fine-grained connection control possible with tcprules/ipsvd-instruct (with the -x option). A few other examples of services may be found here: http://thedjbway.org/services.html Wayne