Re: user-specific services not working as documented?

From: Avery Payne <avery.p.payne_at_gmail.com>
Date: Wed, 15 Oct 2014 14:56:50 -0700

You have some issues there, specifically the repeating ?stdin: is not a tty
message. Ouch. Ouch. Ouch. Ouch. Ouch...

Anyways, here's the rough version as it exists on Debian (although you can
arrange it any way you like, this is merely my suggestion):

/etc/sv is a directory filled with service defintions. Each service
definition is a directory with a run file, finish, log directory, etc. For
this example I'll use mpd.

/etc/sv/mpd is the service definition directory for mpd. There must be at
least one file, /etc/sv/mpd/run, inside of this directory. The run file
will handle the startup of the service and typically (but not necessarily)
is a script. If you want to go all fancy you can use a non-shell launcher,
like execline, and that would work as well. For now, it's a simple script:

#!/bin/shexec 2>&1SVNAME=$(basename `pwd`)# configuration file is
required[ -f /etc/mpd.conf ] || exit 1# ensure a run directory
existsif [ ! -d /var/run/$SVNAME ] ; then mkdir -p /var/run/$SVNAME
chown mpd /var/run/$SVNAMEfiexec chpst -umpd /usr/bin/mpd --no-daemon
--stderr /etc/mpd.conf


Keep in mind, this example control script is very Debian-specific and makes
certain assumptions.

/service is a directory. It contains nothing but soft links that point to
whatever service you want in /etc/sv. For example, you want mpd to be
system-wide? Then you would create a symlink in /service to start it and
manage it:

cd /service ; ln -s /etc/sv/mpd

The link is the "control" and determines if the service will be
managed/started or not. Remove the link, and the service will go down.
You CAN put real directories into /service but you're kinda asking for
trouble, because if you want to pull the service completely you would
delete the directory (and by extension, the control scripts inside you need
to start it again!)

Hopefully this clarifies some things. Oh, there is also a discrepancy in
the runit package for Debian, when you compare it to the documentation for
runit itself. If you look at the /etc/runit/2 shell script you'll see that
it starts in /etc/service not /service. You can use /etc/service if you
like but I just edited the file and made it /service to keep it simple.

With regard to creating /service, no, that's to be expected. Ubuntu is not
Debian but it follows some of Debian's process, and Debian tends to take a
very conservative approach. Placing directories in the root (/ )
filesystem runs against some definitions in the wild *cough*FHS*cough* (I
believe this to be the case, but could be wrong) and therefore it won't
make the directory there. That's why you're seeing it in /etc/service.
See https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard for a
pseudo-overview.

On Wed, Oct 15, 2014 at 2:37 PM, Guy Matz <gmatz_at_matz.org> wrote:

>
>
> [stuff snipped]
> Any thoughts would be greatly appreciated!
>
>
Received on Wed Oct 15 2014 - 21:56:50 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:18 UTC