diff --git a/README.md b/README.md index b8b3ded3..68fae688 100644 --- a/README.md +++ b/README.md @@ -58,27 +58,27 @@ runlevel 2 log size=100k count=4 # Services to be monitored and respawned as needed -service [S12345] /sbin/watchdogd -L -f -- System watchdog daemon -service [S12345] /sbin/syslogd -n -b 3 -D -- System log daemon -service [S12345] /sbin/klogd -n -- Kernel log daemon -service [2345] /sbin/lldpd -d -c -M1 -H0 -i -- LLDP daemon (IEEE 802.1ab) +service [S12345] watchdogd -L -f -- System watchdog daemon +service [S12345] syslogd -n -b 3 -D -- System log daemon +service [S12345] klogd -n -- Kernel log daemon +service [2345] lldpd -d -c -M1 -H0 -i -- LLDP daemon (IEEE 802.1ab) # 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. A single # at the beginning means ntpd does not respect SIGHUP for restart. -service [2345] log:/var/log/ntpd.log /sbin/ntpd -n -l -I eth0 -- NTP daemon +service [2345] log:/var/log/ntpd.log ntpd -n -l -I eth0 -- NTP daemon # For multiple instances of the same service, add :ID somewhere between # the service/run/task keyword and the command. -service :1 [2345] /sbin/merecat -n -p 80 /var/www -- Web server -service :2 [2345] /sbin/merecat -n -p 8080 /var/www -- Old web server +service :80 [2345] merecat -n -p 80 /var/www -- Web server +service :8080 [2345] merecat -n -p 8080 /var/www -- Old web server # Alternative method instead of below runparts, can also use /etc/rc.local -#task [S] /etc/init.d/keyboard-setup start -- Setting up preliminary keymap -#task [S] /etc/init.d/acpid start -- Starting ACPI Daemon -#task [S] /etc/init.d/kbd start -- Preparing console +#task [S] /etc/init.d/keyboard-setup start -- Setting up preliminary keymap +#task [S] /etc/init.d/acpid start -- Starting ACPI Daemon +#task [S] /etc/init.d/kbd start -- Preparing console # Run start scripts from this directory # runparts /etc/start.d @@ -115,20 +115,20 @@ Some components are optional: runlevel(s), condition(s) and description, making it easy to create simple start scripts and still possible for more advanced uses as well: - service /usr/sbin/sshd -D + service sshd -D Dependencies are handled using [conditions](doc/conditions.md). One of the most common conditions is to wait for basic networking to become available: - service /usr/sbin/nginx -- High performace HTTP server + service nginx -- High performace HTTP server Here is another example where we instruct Finit to not start BusyBox `ntpd` until `syslogd` has started properly. Finit waits for `syslogd` to create its PID file, by default `/var/run/syslogd.pid`. - service [2345] log /usr/sbin/ntpd -n -N -p pool.ntp.org - service [S12345] /sbin/syslogd -n -- Syslog daemon + service [2345] log ntpd -n -N -p pool.ntp.org + service [S12345] syslogd -n -- Syslog daemon Notice the `log` keyword, BusyBox `ntpd` uses `stderr` for logging when run in the foreground. With `log` Finit redirects `stdout` + `stderr` @@ -137,7 +137,7 @@ to the system log daemon using the command line `logger(1)` tool. A service, or task, can have multiple dependencies listed. Here we wait for *both* `syslogd` to have started and basic networking to be up: - service [2345] log /usr/sbin/ntpd -n -N -p pool.ntp.org + service [2345] log ntpd -n -N -p pool.ntp.org If either condition fails, e.g. loss of networking, `ntpd` is stopped and as soon as it comes back up again `ntpd` is restarted automatically. @@ -299,10 +299,10 @@ To specify an allowed set of runlevels for a `service`, `run` command, `task`, or `tty`, add `[NNN]` to your `/etc/finit.conf`, like this: ``` -service [S12345] /sbin/syslogd -n -x -- System log daemon -run [S] /etc/init.d/acpid start -- Starting ACPI Daemon -task [S] /etc/init.d/kbd start -- Preparing console -service [S12345] /sbin/klogd -n -x -- Kernel log daemon +service [S12345] syslogd -n -x -- System log daemon +run [S] /etc/init.d/acpid start -- Starting ACPI Daemon +task [S] /etc/init.d/kbd start -- Preparing console +service [S12345] klogd -n -x -- Kernel log daemon tty [12345] /dev/tty1 tty [2] /dev/tty2 @@ -443,7 +443,7 @@ done slightly differently and on systems with udev you might want to add the following one-shot task early in your `/etc/finit.conf`: ```conf -run [S] /sbin/udevadm settle --timeout=120 -- Waiting for udev +run [S] udevadm settle --timeout=120 -- Waiting for udev ``` Finit has a built-in Getty for TTYs, but requires a working `/bin/login` diff --git a/contrib/finit.conf b/contrib/finit.conf index 87f699d7..0e106183 100644 --- a/contrib/finit.conf +++ b/contrib/finit.conf @@ -33,22 +33,21 @@ tty /dev/tty3 #run [2] /etc/init.d/networking start -- Start networking # Services to be monitored and respawned as needed -service [2345] /sbin/klogd -n -- Kernel logging server -service [2345] /sbin/syslogd -n -- Syslog server -service [3] /usr/sbin/gdm -- GNOME Display Manager +service [2345] klogd -n -- Kernel logging server +service [2345] syslogd -n -- Syslog server +service [3] gdm -- GNOME Display Manager # 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. A single # at the beginning means ntpd does not respect SIGHUP for restart. -service [2345] log:/var/log/ntpd.log /sbin/ntpd -n -l -I eth0 -- NTP daemon +service [2345] log:/var/log/ntpd.log ntpd -n -l -I eth0 -- NTP daemon # Run start scripts from this directory # runparts /etc/start.d # For multiple instances of the same service, add :ID somewhere between # the service/run/task keyword and the command. -service :1 [2345] /sbin/httpd -f -h /http -p 80 -- Web server -service :2 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server - +service :80 [2345] /sbin/httpd -f -h /http -p 80 -- Web server +service :8080 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server diff --git a/doc/config.md b/doc/config.md index 3c1c4d10..aac51ea9 100644 --- a/doc/config.md +++ b/doc/config.md @@ -354,7 +354,7 @@ Every `run`, `task`, or `service` can also list the privileges the `[@USR[:GRP]]` like this: ```shell - run [2345] @joe:users /usr/bin/logger "Hello world" + run [2345] @joe:users logger "Hello world" ``` For multiple instances of the same command, e.g. a DHCP client or @@ -362,8 +362,8 @@ multiple web servers, add `:ID` somewhere between the `run`, `task`, `service` keyword and the command, like this: ```shell - service :1 [2345] /sbin/httpd -f -h /http -p 80 -- Web server - service :2 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server + service :80 [2345] httpd -f -h /http -p 80 -- Web server + service :8080[2345] httpd -f -h /http -p 8080 -- Old web server ``` Without the `:ID` to the service the latter will overwrite the former