lxinitd handbook

lxinitd services

In lxinitd has simple service management.

lxinitd have two states, either process is running or its not: lxinitd will try to restart it.

lxinitd keeps track of the number of times it reboots a process.

The first time it reboots a process it will be instantaneous, subsequent reboots will have a slight delay to prevent a process that continuously fails from taking all the CPU. e.g. a process fails because it runs out of diskspace, will likely not restart. lxinitd will keep retrying to start it indefinitely.

respawn

The respawn builtin restarts a process if it exits, almost immediately.

example

respawn /sbin/getty -L tty1 115200 vt100

respawn accepts one option -u username to specify a different user for the process. Only user id and grouyp id are set there is no difference in the environment, working directory or shell.

service

The service builtin, checks for the creation of a pid file, it reads the pid from this file and monitors the process's existence every 3 seconds.

example

service /run/nginx.pid /sbin/nginx

If the process dies it will be restarted. If lxinitd is pid 1, i.e. the /sbin/init process started by the Linux kernel, it will restart the process immediately since all processes are its children. lxinitd can be run from the command line, in which case, it may take 3 seconds to restart the process.

service also accepts the -u username option.



by teknopaul