mirror of
https://github.com/troglobit/finit.git
synced 2026-10-24 11:54:36 +00:00
Reference sections kept pointing at the line-based format they no longer
document. `sysv` and `task` sent the reader to Services for "<COND>",
the cgroups chapter opened by listing three legacy directives and then
explained further down that only two of them exist here, and the logging
chapter still gave "log:prio:facility.level,tag:ident" as the full
syntax.
Some claims were wrong independent of the format:
- a sysv is a supervised daemon, grouped with service in
SVC_TYPE_DAEMON, not a variation on task
- restart-max has no upper bound of 255, or any other
- the built-in rescue fallback runs in 12345789, not 12345
- conditional loading quotes system/10-hotplug.conf, not
system/hotplug.conf
- the key spells conflicts, not conflict
- the built-in getty no longer wants TERM last, it is a key
`if` takes either a service name or, in angle brackets, a condition,
decided in svc_ifthen(). Only the examples showed this, so it is now
said.
Terminology follows the split index.md already draws: a block is the new
format, a stanza the line-based one.
src/rescue.conf was still line-based, missed because it sits in src/
rather than system/ or contrib/.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
37 lines
1.1 KiB
Markdown
37 lines
1.1 KiB
Markdown
Service Wrapper Scripts
|
|
=======================
|
|
|
|
If your service requires to run additional commands, executed before the
|
|
service is actually started, like the systemd `ExecStartPre`, you can
|
|
use a wrapper shell script to start your service.
|
|
|
|
The Finit service `.conf` file can be put into `/etc/finit.d/available`,
|
|
so you can control the service using `initctl`. Then use the path to
|
|
the wrapper script in the Finit `.conf` service block. The following
|
|
example employs a wrapper script in `/etc/start.d`.
|
|
|
|
**Example:**
|
|
|
|
* `/etc/finit.d/available/program.conf`:
|
|
|
|
service program {
|
|
description = "Example Program"
|
|
runlevel = "235"
|
|
reload-signal = "none"
|
|
command = "/etc/start.d/program"
|
|
}
|
|
|
|
* `/etc/start.d/program:`
|
|
|
|
#!/bin/sh
|
|
# Prepare the command line options
|
|
OPTIONS="-u $(cat /etc/username)"
|
|
|
|
# Execute the program
|
|
exec /usr/bin/program $OPTIONS
|
|
|
|
> [!NOTE]
|
|
> The example sets `reload-signal = "none"` to say the program does not
|
|
> support `SIGHUP`. Finit then stop/starts the service instead of
|
|
> signalling it at restart/reload events.
|