diff --git a/src/sample.conf b/src/sample.conf index 685def76..eb2b28cc 100644 --- a/src/sample.conf +++ b/src/sample.conf @@ -1,4 +1,12 @@ -# sample.conf: template run/task/service stanza for finit +# 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. @@ -25,6 +33,16 @@ # | | `--------------------------------------------------------------- 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] env:-/etc/default/ssh /usr/sbin/sshd -D $SSHD_OPTS -- OpenSSH daemon @@ -33,11 +51,11 @@ #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] env:-/etc/conf.d/dropbear dropbear -R -F $DROPBEAR_OPTS -- Dropbear SSH daemon +#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] log acpid -f -- ACPI daemon +#service [2345] 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