supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: "Wayne Marshall" <wcm@guinix.com>
Subject: Re: Daemontools run script
Date: 2 Aug 2006 09:59:01 -0700	[thread overview]
Message-ID: <20060802095901.3a1d0862@alloy.copperisle.com> (raw)
In-Reply-To: <032F7A897DBD0E4EAA8F57DCFBAE979F16FFFC@ukplc01.internal.calleva.ukplc.net>

On Wed, 2 Aug 2006 10:07:28 +0100
"ed neville" <ed.neville@ukplc.net> 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





  reply	other threads:[~2006-08-02 16:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-02  9:07 ed neville
2006-08-02 16:59 ` Wayne Marshall [this message]
2006-08-02 20:09 ` Laurent Bercot
2006-08-03 18:35 ` George Georgalis
  -- strict thread matches above, loose matches on Subject: below --
2006-08-01  9:15 ed neville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060802095901.3a1d0862@alloy.copperisle.com \
    --to=wcm@guinix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).