# sample.conf: template cgroup/run/task/service stanza for finit
#
# The top-level cgroups can be defined anywhere, but share the same
# namespace.  It is up to the user to ensure groups are defined only
# once, otherwise the last read .conf wins.  See below for assigning
# run/task/services to cgroups.  The below example creates the cgroup
# NAME with the following cpu and memory settings:
#
#   cgroup NAME cpu.weight:1000 mem.max:65
#
# The one-shot commands 'run' and 'task' are called only once per
# runlevel.  Finit does not restart them when they exit.
#
# - run     : wait for completion before continuing with next stanza
# - task    : like run but started in background, parallel with other stanzas
# - service : supervised daemon, run in foreground, restarted if it crashes
#
# The env: is an optional path to a file with environment variables to
# adjust the behavior of daemons.  Debian and Buildroot use /etc/default
# while Alpine use /etc/conf.d -- ensure your Finit is built correctly.
# The leading '-' determines if its OK to start the service even if the
# env file is missing.
#
#     run [LVLS] <COND> log command ARGS -- Command
#    task [LVLS] <COND> log command ARGS -- Command
# service [LVLS] <COND> log env:[-]/etc/default/daemon daemon ARGS -- Daemon daemon
# ^       ^      ^      ^   ^                          ^              ^       ^
# |       |      |      |   |                          |              |        `-- Optional description
# |       |      |      |   |                          |              `----------- Daemon arguments
# |       |      |      |   |                          `-------------------------- Path to daemon
# |       |      |      |    `---------------------------------------------------- Optional env. file
# |       |      |       `-------------------------------------------------------- Redirect output to log
# |       |       `--------------------------------------------------------------- Optional conditions
# |        `---------------------------------------------------------------------- Optional Runlevels
#  `------------------------------------------------------------------------------ Monitored application
#
# Each stanza can also hold a 'cgroup' argument, or be prefixed with
# cgroup.NAME to place all following stanzas in the same group.  In
# the following example, foo and bar share the cgroup foo but baz
# runs in its own cgroup baz:
#
#   cgroup.foo
#   service cgroup:cpu.weight:250,mem.max:655350 foo args -- foo desc
#   service cgroup:cpu.weight:150,mem.max:655350 bar args -- bar desc
#   service cgroup.baz:cpu.weight:300 baz args -- baz desc

# Debian GNU/Linux: start SSH daemon as soon as basic networking comes up
#service [2345] <net/lo/up> env:-/etc/default/ssh /usr/sbin/sshd -D $SSHD_OPTS -- OpenSSH daemon

# Alpine Linux: Oneshot task to run once at bootstrap, yes pipes are possible :)
#task [S] env:/etc/conf.d/loadkmap zcat $KEYMAP | loadkmap -- Loading keymap

# Alpine Linux: start SSH daemon with $DROPBEAR_OPTS from /etc/conf.d
#service [2345] cgroup.user env:-/etc/conf.d/dropbear dropbear -R -F $DROPBEAR_OPTS -- Dropbear SSH daemon

# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
# Depends on syslogd having started. Redirect any output to log.
#service [2345] <pid/syslogd> cgroup:mem.max:32000,cpu.max:1000 log acpid -f -- ACPI daemon

# Start rsyslogd as soon as possible, should always run
# Provides pid/syslogd condition
#service [S12345] name:syslogd env:-/etc/default/rsyslog rsyslogd -n $RSYSLOGD_OPTIONS -- Reliable syslog daemon
