man(1) Manual page archive

     INIT(8)                                                   INIT(8)

          init - process control initialization


          Init is invoked inside Unix as the last step in the boot
          procedure.  It normally then runs the automatic reboot
          sequence as described in reboot(8), and if this succeeds,
          begins multi-user operation.  If the reboot fails, it com-
          mences single user operation by giving the super-user a
          shell on the console.  It is possible to pass parameters
          from the boot program to init so that single user operation
          is commenced immediately.  When such single user operation
          is terminated by killing the single-user shell (i.e. by hit-
          ting ^D), init runs /etc/rc without the reboot parameter.
          This command file performs housekeeping operations such as
          removing temporary files, mounting file systems, and start-
          ing daemons.

          In multi-user operation, init's role is to create a process
          for each terminal port on which a user may log in.  To begin
          such operations, it reads the file /etc/ttys and forks to
          create a process for each terminal specified in the file.
          Each of these processes opens the appropriate terminal for
          reading and writing on file descriptors 0, 1, 2, and 3 (the
          standard input and output, the diagnostic output and
          /dev/tty). Opening the terminal will usually involve a
          delay, since the open is not completed until someone dials
          and carrier is established on the channel.  Then /etc/getty
          is called with argument as specified by the second character
          of the ttys file line.  Getty reads the user's name and
          invokes login to log in the user and execute the shell.

          Ultimately the shell will terminate because of an end-of-
          file either typed explicitly or generated as a result of
          hanging up.  The main path of init, which has been waiting
          for such an event, wakes up and removes the appropriate
          entry from the file utmp, which records current users, and
          makes an entry in /usr/adm/wtmp, which maintains a history
          of logins and logouts.  Then the appropriate terminal is
          reopened and getty is reinvoked.

          Init catches the hangup signal (signal SIGHUP) and inter-
          prets it to mean that the file /etc/ttys should be read
          again.  The shell process on each line which used to be
          active in ttys but is no longer there is terminated; a new
          process is created for each added line; lines unchanged in
          the file are undisturbed.  Thus it is possible to drop or

     INIT(8)                                                   INIT(8)

          add terminal lines without rebooting the system by changing
          the ttys file and sending a hangup signal to the init pro-
          cess: use `kill -1 1.'

          Init will terminate multi-user operations and resume
          single-user mode if sent a terminate (SIGTERM, the default)
          signal, i.e. `kill 1'.  If there are processes outstanding
          which are deadlocked (due to hardware or software failure),
          init will not wait for them all to die (which might take
          forever), but will time out after 30 seconds and print a
          warning message.

          Init's role is so critical that if it dies, the system will
          reboot itself automatically.  If, at bootstrap time, the
          init process cannot be located, the system will loop in user
          mode at location 0x13.

          /dev/console, /dev/tty?, /etc/utmp, /usr/adm/wtmp,
          /etc/ttys, /etc/rc

          login(8), kill(1), sh(1), ttys(5), getty(8), rc(8),