INIT(8)

NAME
init - grandparent of all processes

DESCRIPTION
The first program started by Minix is init. The actions performed by init can be summarized by this pseudo shell program:
    # Reboot on SIGABRT (sent by the kernel on CRTL-ALT-DEL)
    trap reboot 6
    # Run the system initialization script.
    sh /etc/rc </dev/console >/dev/console 2>&1
    >/etc/utmp
    echo reboot >>/usr/adm/wtmp
    ttys=`cat /etc/ttys`
    # Reread /etc/ttys on a hangup signal.
    trap 'ttys=`cat /etc/ttys`' 1
    # Stop everything on a terminate.
    trap 'ttys=' 15
    while :; do
    	# Wait for a process to exit.
    	wait
    	# Record logout.
    	for tty in $ttys
    	do
    		if exited $tty
    		then
    			echo "logout $tty" >>/etc/utmp
    			echo "logout $tty" >>/usr/adm/wtmp
    		fi
    	done
    	# Start a new session.
    	for tty in $ttys
    	do
    		if idle $tty
    		then
    			stty ... <$tty
    			getty <$tty >$tty 2>&1 &
    		fi
    	done
    done
Init naturally has process ID 1, so kill -1 1 should be used to make init reload the /etc/ttys file after it has been edited.

The utmp and wtmp handling is not a dumb as this of course, but you get the picture.

FILES

/etc/ttys
    List of terminals devices.

/etc/utmp
    List of currently logged in users.

/usr/adm/wtmp
    Login/logout history.

SEE ALSO
ttys(5), utmp(5), boot(8).

AUTHOR
Kees J. Bot (kjb@cs.vu.nl)