[Box-Admins] How is source.squeak.source started on box2 (daemontools?)

Tobias Pape Das.Linux at gmx.de
Wed Oct 16 07:50:59 UTC 2013


On 16.10.2013, at 01:25, David T. Lewis <lewis at mail.msen.com> wrote:

> How is our source.squeak.org image is being started at system boot time on
> box2? I gather from previous messages that it is (and should be) done with
> daemontools. I have no experience with daemontools, but I want to do the
> same thing for squeaksource.com on box3 if possible.

I have written a how to for dameontools+gemstone[1], so I probably can help you there?
Daemontools has its quirks, it expects certain directory structures
and certain handling of input and output,
but in a nutshell

0. On debian, use the packages
	daemontools	The daemontools
	daemontools-run	Helper script to automatically start daemontools
	svtools		(optional but very useful)
1. the service directory.
	you should execute all commands from the service directory.
	For default daemontools installation, this typically is `/service`,
	for debian, it is `/etc/service`
	The `svdir` command from the svtools package also prints that directory.
1b. the template directory.
	Debian loves symlinks. Therefore, it has templates for its
	services in `/etc/sv`. The idea is:
		1. create your service as directory in `/etc/sv`
		2. link it into `/etc/service`
		n. if you use daemontools-run or daemontools are already started,
		   it should pick up the directory and start your service
2. main commando: `svc`
	0. just executing `svc` does nothing…, so does `svc --help` (not `svc -h`, 
	   but it does not print a help page either)
	0b. man svc :)
	1. start a service (and keep it Up):	`svc -u servicedirectoryname`
	2. start a service but just Once:	`svc -o servicedirectoryname`
	3. Terminate a service (will restart):	`svc -t servicedirectoryname`
	4. stop a service and keep it Down:	`svc -d servicedirectoryname`

3. Make sure that your scripts `exec` the actual executable, daemontools expects that.
   Also, `servicedirectoryname` has to have an executable file named `run` that runs
   your service.
     `svsetup` from the svtools package can help here.
   
4. Make sure, that the executable (squeak in that case) understands unix signals,
   at least TERM and KILL, correctly; STOP, CONT, and HUP would be nice.

5. optional: logging
   create a `log` directory in `servicedirectoryname` and use `multilog` in it like
	#! /bin/sh
	exec multilog t ./main
   and from then, it will log to `servicedirectoryname/log/main`. the file `current`
   is the current log, all other files are named with TAI[2] timestamp.
	0. you can inspect the log files in `servicedirectoryname/log/main` manually, or
	1. use `mlcat servicedirectoryname` to print the latest log.
	2. likewise, `mltac` (cats reverse) `mltail`, `mlhead`. all four are from the 
	   `svtools` package

6. optional: init.d script
   `svinitd` and `svinitd-create` help to create /etc/init.d/scripts for your service.
   NOTE: the scripts created `svinitd-create` are not yet ready for dependency-based boot[3]
   but changing that is near trivial. Moreover, if you create init.d script, DO NOT use them
   to start your service at boot, daemontools already take care of that.

7. other stuff:
	`svstat`: print info about service
	`svinfo`: equivalent from svtools, more versatile
	`svok`: checks whether a service is properly supervised; no output.
	*`setuidgid`: runs program as specified user and group
	*`softlimit`: runs program with specified resource limits
	*`envdir`: runs program with environment variables specified in a directory of files.
	*`envuidgid`: runs program as user specified by an environment variable/
   * can be used in `run` script

HTH

Best
	-Tobias



[1] https://code.google.com/p/glassdb/wiki/GLASSDaemonTools
[2] https://en.wikipedia.org/wiki/International_Atomic_Time, with tai64n(8)
[3] https://wiki.debian.org/LSBInitScripts/DependencyBasedBoot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://lists.squeakfoundation.org/pipermail/box-admins/attachments/20131016/f0e0b3e5/signature.pgp


More information about the Box-Admins mailing list