# Sample finit.conf to demonstrate the syntax # hostname = "testbed" # Linux kernel modules to load modules = { "button", "evdev", "loop", "psmouse" } # Top-level cgroups and their default settings. All groups mandatory # but more can be added, max 8 groups in total currently. The cgroup # 'root' is also available, reserved for RT processes. Settings are # as-is, only one shorthand 'mem.' exists, other than that it's the # cgroup v2 controller default names. cgroup init { cpu.weight = 100 } cgroup user { cpu.weight = 100 } cgroup system { cpu.weight = 9700 cpu.max = 50000 } # Example extra cgroup cgroup maint { cpu.weight = 100 } # Runlevel to start after bootstrap, runlevel 'S' runlevel = 2 # Network bringup script network = "service networking start" # Max file size for each log file: 100 kiB, rotate max 4 copies: # log => log.1 => log.2.gz => log.3.gz => log.4.gz log { size = 100k count = 4 } # Virtual consoles to start getty on tty tty1 { device = "/dev/tty1" } tty tty2 { device = "/dev/tty2" } tty tty3 { device = "/dev/tty3" } # Task to run if ctrl-alt-del is pressed. This condition is asserted by # Finit upon receiving SIGINT (from the kernel). task reboot { description = "Rebooting system" runlevel = "12345789" conditions = { "sys/key/ctrlaltdel" } command = "initctl reboot" } # Task to run if the kernel gets a power fail condition is pressed. # Asserted by Finit upon receiving SIGPWR (from the kernel). task poweroff { description = "Shutting down system" runlevel = "12345789" conditions = { "sys/pwr/fail" } command = "initctl poweroff" } # Alternative method instead of runparts #task keyboard-setup { # description = "Setting up preliminary keymap" # runlevel = "S" # command = "/etc/init.d/keyboard-setup start" #} #task acpid { # description = "Starting ACPI Daemon" # runlevel = "S" # command = "/etc/init.d/acpid start" #} #task kbd { # description = "Preparing console" # runlevel = "S" # command = "/etc/init.d/kbd start" #} #run networking { # description = "Start networking" # runlevel = "2" # command = "/etc/init.d/networking start" #} # Services to be monitored and respawned as needed # klogd and syslogd are placed in the maint cgroup. There is no # "current cgroup" to switch in this format, every block names its own. service klogd { description = "Kernel logging server" runlevel = "2345" conditions = { "pid/syslogd" } cgroup maint {} command = "klogd -n" } service syslogd { description = "Syslog server" runlevel = "2345" cgroup maint {} command = "syslogd -n" } # gdm gets its own limits inside the system group, which is where # services end up when no cgroup block is given. service gdm { description = "GNOME Display Manager" runlevel = "3" cgroup system { cpu.weight = 250 memory.max = 10M } command = "gdm" } # Start SSH daemon with opts from /etc/default/ssh (if available), move # to user cgroup with cpu.weight 250. Default weight in the user group # is 100 (above). service sshd { description = "OpenSSH daemon" runlevel = "2345" envfile = "-/etc/default/ssh" cgroup user { cpu.weight = 250 memory.max = 10M } command = "/usr/sbin/sshd -D $SSHD_OPTS" } # The BusyBox ntpd does not use syslog when running in the foreground # So we use this trick to redirect stdout/stderr to a log file. The # log file is rotated with the above settings. The condition declares # a dependency on a system default route (gateway) to be set. ntpd # does not respect SIGHUP, so Finit restarts it on reload instead. service ntpd { description = "NTP daemon" runlevel = "2345" conditions = { "net/route/default" } reload-signal = "none" log { file = "/var/log/ntpd.log" } command = "ntpd -n -l -I eth0" } # Run start scripts from this directory #runparts = "/etc/start.d" # For multiple instances of the same service, add :ID to the block title. service httpd:80 { description = "Web server" runlevel = "2345" command = "/sbin/httpd -f -h /http -p 80" } service httpd:8080 { description = "Old web server" runlevel = "2345" command = "/sbin/httpd -f -h /http -p 8080" }