Re: How to use s6 and s6-rc together

2017-05-19 Thread Robert Hill
On Thu, May 18, 2017 at 5:02 PM, Luis Ressel  wrote:

> ​>​
> ​ ​
> Yes, when your init exec's into s6-svscan, it will immediately start all
> ​>​
> ​ ​
> services in the scandir (unless the corresponding servicedir contains
> ​>​
> ​ ​
> a down file).
> ​>​
>
> ​>​
> ​ ​
> However, the scandir will typically be empty at this point (it may
> ​>​
> ​ ​
> contain an early getty service). It is only populated with services
> ​>​
> ​o​
> nce you call s6-rc-init (to be exact, s6-rc-init creates the
> ​>​
> ​ ​
> servicedirs in /run/s6-rc/servicedirs and then symlinks them into the
> ​>​
> ​ ​
> scandir). s6-svscan will still not start the services, though, since
> ​>​
> ​ ​
> all the servicedirs created by s6-rc-init will contain a down file.
> ​>​
> ​ ​
> They will only be started once you call s6-rc -u change ok-all (ok-all
> ​>​
> ​ ​
> being the s6-rc bundle containing all your services).
>

​Ah, I see my error was assuming that scandirs were static for the life of
the current boot, rather than having service directories symlinked in.​

​
Thanks for the help.


Re: How to use s6 and s6-rc together

2017-05-18 Thread Laurent Bercot

If you're using down files to determine startup order, do you have a
different filename (LittKit calls it 'reallydown") to take over the
former functionality of the down file (to make the service down for
awhile, through reboots)?

 There's no need for such a thing when your services are managed via
s6-rc. The machine state you want is encoded in your service database,
and your stage 2 init runs s6-rc with the correct arguments to bring
the machine state to the one you want. Through reboots, the same state
is enforced as long as the default service database doesn't change.

 I really recommend that you read the s6-rc documentation if you want to
understand how it works.

--
 Laurent



Re: How to use s6 and s6-rc together

2017-05-18 Thread Steve Litt
On Fri, 19 May 2017 00:02:00 +0200
Luis Ressel  wrote:

> On Thu, 18 May 2017 16:28:17 -0500
> Robert Hill  wrote:
> 
> > The overview for s6-rc
> >  mentions that:
> >   
> > > the chosen init should make sure that a s6 supervision tree is up
> > > and running. s6-rc will only work if there is an active s6-svscan
> > > process monitoring a scan directory.
> > 
> > This is a little confusing to me, and I am sure I am not
> > understanding correctly. If s6-svscan is monitoring a scan
> > directory, won't all the processes in that scan directory already
> > have been started by the s6-supervise instances that get started by
> > s6-svscan? I would like to use s6-rc to start all services and s6
> > to supervise them once started.  
> 
> Yes, when your init exec's into s6-svscan, it will immediately start
> all services in the scandir (unless the corresponding servicedir
> contains a down file).
> 
> However, the scandir will typically be empty at this point (it may
> contain an early getty service). It is only populated with services
> once you call s6-rc-init (to be exact, s6-rc-init creates the
> servicedirs in /run/s6-rc/servicedirs and then symlinks them into the
> scandir). s6-svscan will still not start the services, though, since
> all the servicedirs created by s6-rc-init will contain a down file.
> They will only be started once you call s6-rc -u change ok-all (ok-all
> being the s6-rc bundle containing all your services).

This sounds something like the way I incorporated determinate startup
order to daemontools, runit and s6 using LittKit:

http://troubleshooters.com/projects/littkit/README

http://www.troubleshooters.com/linux/diy/suckless_init_on_plop.htm#littkit_introduction

If you're using down files to determine startup order, do you have a
different filename (LittKit calls it 'reallydown") to take over the
former functionality of the down file (to make the service down for
awhile, through reboots)?

Thanks,

SteveT

Steve Litt 
May 2017 featured book: Twenty Eight Tales of Troubleshooting
http://www.troubleshooters.com/28




Re: How to use s6 and s6-rc together

2017-05-18 Thread Luis Ressel
On Thu, 18 May 2017 16:28:17 -0500
Robert Hill  wrote:

> The overview for s6-rc
>  mentions that:
> 
> > the chosen init should make sure that a s6 supervision tree is up
> > and running. s6-rc will only work if there is an active s6-svscan
> > process monitoring a scan directory.  
> 
> This is a little confusing to me, and I am sure I am not understanding
> correctly. If s6-svscan is monitoring a scan directory, won't all the
> processes in that scan directory already have been started by the
> s6-supervise instances that get started by s6-svscan? I would like to
> use s6-rc to start all services and s6 to supervise them once started.

Yes, when your init exec's into s6-svscan, it will immediately start all
services in the scandir (unless the corresponding servicedir contains
a down file).

However, the scandir will typically be empty at this point (it may
contain an early getty service). It is only populated with services
once you call s6-rc-init (to be exact, s6-rc-init creates the
servicedirs in /run/s6-rc/servicedirs and then symlinks them into the
scandir). s6-svscan will still not start the services, though, since
all the servicedirs created by s6-rc-init will contain a down file.
They will only be started once you call s6-rc -u change ok-all (ok-all
being the s6-rc bundle containing all your services).

Have you checked out the s6-linux-init package? It will generate an
init script that takes care of all the subtleties required to start
s6-svscan and kick of s6-rc. The only thing you still have to do by
yourself it writing the actual s6-rc services (and the s6-rc package
contains an example/ dir you can use as a reference for that).

> The page for s6-supervise
>  indicates that it
> will only start services if the default service state is up. Does
> that imply that the default service state for all services with
> dependencies should be down, so that they do not get started when
> s6-svscan is run (thus enabling s6-rc to start them according to the
> dependency graph)?

Yes, the default state for all services managed by s6-rc should be
"down". But that doesn't mean you have to drop a down file in every
service directory; as I mentioned above, s6-rc-init will automatically
take care of that when it copies the servicedirs over to the /run
filesystem.

Cheers,
Luis Ressel 


pgpGsD2CDOyj_.pgp
Description: OpenPGP digital signature


How to use s6 and s6-rc together

2017-05-18 Thread Robert Hill
Hello list,

I have read the documentation for s6 and s6-rc at skarnet.org, but I
am having a little trouble understanding the fundamentals of how to get my
Slackware box running using it as both the init, process supervisor, and
service manager. (I am still in the exploratory stages of this project; I
am trying to plan out what my strategy will be before I jump in. My
eventual goal will be to provide Slackbuild scripts for these packages and
dependencies for ease of installation on Slackware, although it will be my
first attempt at creating Slackbuilds.)

The overview for s6-rc 
mentions that:

> the chosen init should make sure that a s6 supervision tree is up and
> running. s6-rc will only work if there is an active s6-svscan process
> monitoring a scan directory.

This is a little confusing to me, and I am sure I am not understanding
correctly. If s6-svscan is monitoring a scan directory, won't all the
processes in that scan directory already have been started by the
s6-supervise instances that get started by s6-svscan? I would like to use
s6-rc to start all services and s6 to supervise them once started.

The page for s6-supervise 
indicates that it will only start services if the default service state is
up. Does that imply that the default service state for all services with
dependencies should be down, so that they do not get started when s6-svscan
is run (thus enabling s6-rc to start them according to the dependency
graph)?

Thanks,

Robert Hill