The s6 and s6-rc
program handle and use different kind of services and files. If you have any
idea of what we talk about you can find informations here
for what we call on Obarun classic service and here
for oneshot, longrun, bundle service. It can be complex to deal and
understand the link between those files and kind of services. So the 66
frontend was born to allow you to deal with all this kind of services with
one file.
By default the 66 tools expect to find services files at /etc/66/service but it
can be changed at compile-time by giving the --with-service-path=DIR
option to ./configure.
This file have a format of INI file with specific syntax on key field. The name of the file correspond generally at the name of the daemon and do not have any extension or prefix.
The file is splitted into section which contain a key value pair.
The name can contain character like '-', '_' and so on except the '@' character which is case reserve.
/etc/66/service/dhcpcd
/etc/66/service/very_long_name
[main] @type = classic @name = dhcpcd @description = "dhcpcd daemon" @user = ( root ) @max-death = 3 @options = ( log ) [start] @build = auto @execute = ( /usr/bin/dhcpcd -B ) [logger] @build = auto @backup = 2 @maxsize = 1000000 @timestamp = iso [environment] CONF=/etc/dhcpcd.conf
In the general way the parser will not accept any empty value. If a key is set, the value cannot be empty. Comment are allowed using the character #. Empty line are also allowed.
All key name are case reserve and cannot be employ to suit your needs. However the name of the key should be specific enough to avoid conflict with your needs.
Section can be declared in any order but a good practice is to declare the [main] section at the first place. In this way the parser will gain in time to treat the file.
All sections need to be declared with the name set between '[]' bracket pair. The name of the section do not contain uppercase and may not contain any other character appart lowercase letter. An entire section can be commented placing the # at the beginning of section name like this:
#[stop]
The frontend file use these valid section name:
A section can be a mandatory one but not all the key field are necessarily mandatory.
Divers syntax format is used to parse the value of a key.
example of valid syntax
@type = classic
@type=classic
example of unvalid syntax
@type= classic
example of valid syntax
@description = " some awesome description "
@description="some awesome description"example of unvalid syntax
@description = " new line onto double-quote is not allowed"
example of valid syntax
@depends = ( fooA fooB fooC )
@depends=(fooA fooB fooC)
@depends=( fooA fooB fooC )
example of unvalid syntax
@depends = (fooAfooB fooC)
example of valid syntax
@notify = 3
@notify=3
example of unvalid syntax
@notify= 3
example of valid syntax
@destination = /etc/66
@destination=/etc/66
example of unvalid syntax
@destination=/a/very/ long/path
example of valid syntax
MYKEY = MYVALUE
anotherkey=anothervalue
example of unvalid syntax
MYKEY= MYVALUE
Declare the type of the service.
mandatory : yes.
syntax : line
valid value :
Name of the service.
mandatory : yes.
syntax : line
valid value :
A short description of the service.
mandatory : yes.
syntax : quote
valid value :
Declare the permissions of the service.
mandatory : yes.
syntax : bracket
valid value :
Be aware that root are not automatically added. If you don't declare root in this field, you will not be able to use the service even with root privilegies.
Declare the dependencies of the service.
mandatory : no.This field have no effect if the type of the service is set to classic
syntax : bracket
valid value :
The order declaration is important. If fooA depends of fooB and fooB depends of fooC the field value need to be:
@depends=(fooA fooB fooC)
It is unnecessary to manually define complete sets of dependencies in the @depends field, because the parser will properly handle dependency chains. If fooA depends on fooB, no matter the underlying implementation of fooB, and the current implementation of fooB depends on fooC, then you should just put fooB in fooA @depends key field; when starting the set, 66-enable will parse and enable fooA, fooB and fooC and 66-start will start fooC first, then fooB, then fooA. If the underlying implementation of fooB changes and does not depend on fooC, then you will just have to modify the @depends field for fooB, and the definition of fooA @depends will still be correct.
Of course, if fooA depends on fooC anyway, you should add both fooB and fooC at the fooA @depends field.Declare the contents of a bundle service.
mandatory : no except for a service declare as bundle type. This field have no effect for a service declare as classic type.
syntax : bracket
valid value :
mandatory : no.
syntax : bracket
valid value :
mandatory : no.
syntax : bracket
valid value :
This will create the file nosetsid.
If such a file exists, the service will not be started as process group and session leader; the service will be run in the same process group as the supervisor of the service (a.k.a. s6-supervice). If no nosetsid file exists, the service has its own process group and is started as a session leader.
This will create the file down.
If such a file exists, the default state of the service is considered down, not up: the service will not automatically started until it receives a 66-start command. If no down file exists, the default state of the service is up.
mandatory : no.
syntax : uint
valid value :
If such a file exists, it means that the service supports readiness notification. The value is the number of the file descriptor that the service writes its readiness notification to. (For instance, it should be 1 if the daemon is s6-ipcserverd run with the -1 option.) When a service is started, or restarted, if this file exists and contains a valid descriptor number, 66-start will wait for the notification from the service and broadcast readiness, i.e. any 66-svctl -U processes will be triggered.
mandatory : no.
syntax : uint
valid value :
If such a file exists the value is the number of milliseconds after which the ./finish script, if it exists, will be killed with a SIGKILL. The default is 5000: finish scripts are killed if they're still alive after 5 seconds. A value of 0 allows finish scripts to run forever.
mandatory : no.
syntax : uint
valid value :
If such a file exists the value is unsigned integer t. If t is nonzero, then on receipt of a 66-stop command, which sends a SIGTERM and a SIGCONT to the service, a timeout of t milliseconds is set; and if the service is still not dead after t milliseconds, then it is sent a SIGKILL. If timeout-kill does not exist, or contains 0 or an invalid value, then the service is never forcibly killed (unless, of course, a s6-svc -k command is sent).
mandatory : no.
syntax : uint
valid value :
If such a file exists the value is the number of the maximum number of milliseconds 66-start will wait for successful completion of the service start; if starting the service takes longer than this value, 66-start will declare the transition a failure. If the file does not exist, a value of 3000 (3 seconds) is took. If the value is 0, no timeout is defined and 66-start will wait for the service to start till the maxdeath is not reached.
mandatory : no.
syntax : uint
valid value :
If such a file exists the value is the number of the maximum number of milliseconds 66-stop will wait for successful completion of the service stop; if starting the service takes longer than this value, 66-stop will declare the transition a failure. If the file does not exist, a value of 3000 (3 seconds) is took. If the value is 0, no timeout is defined and 66-stop will wait for the service to start till the maxdeath is not reached.
mandatory : no.
syntax : uint
valid value :
If such a file exists the value is the number of the maximum number of service death events that supervisor will keep track of. If the service dies more than this number of times, the oldest events will be forgotten and the transition (66-start or 66-stop) will be declared as failed. Tracking death events is useful, for instance, when throttling service restarts. The value cannot be greater than 4096. If the file does not exist, a default of 3 is used.
How to parse the @execute key value to make the scripts which start the service.
mandatory : yes.
syntax : line
valid value :
How to parse the @execute key value to make the scripts which start the service.
mandatory : yes.
syntax : line
valid value :