man(1) Manual page archive


     INIT(8)                                                   INIT(8)

     NAME
          init - process control initialization

     SYNOPSIS
          /etc/init

     DESCRIPTION
          Init is invoked by the operating system as the last step in
          the boot procedure.  It is always process 1.

          When started normally, init calls rc(8) with parameter
          autoboot.  If this succeeds, init begins multi-user opera-
          tion.  If rc fails, init commences single user operation by
          giving the super-user a shell on the console.  It is possi-
          ble to pass parameters from the boot program to init so that
          single user operation is commenced immediately.  When the
          single user shell terminates, init runs rc without the
          parameter, and begins multi-user operation.

          Rc performs housekeeping such as checking and mounting file
          systems and starting daemons; see rc(8).

          In multi-user operation, init's role is to create a process
          for each directly connected terminal port on which a user
          may log in.  To begin such operations, it reads the ttys(5)
          file and forks to create a process for each terminal speci-
          fied in the file.  Each of these processes opens the appro-
          priate terminal for reading and writing on file descriptors
          0, 1, 2, and 3 (the standard input and output, the diagnos-
          tic output and 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 getty(8) is
          called with argument as specified by the second character of
          the ttys file line.  Getty reads the user's name and invokes
          login(8) to log in the user and execute the shell.

          Ultimately the shell will terminate because of an end-of-
          file or 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(5), which
          records current users, and makes an entry in wtmp, which
          maintains a history of logins and logouts.  Then the appro-
          priate terminal is reopened and getty is invoked again.

          Init catches signal SIGHUP and interprets it to mean that
          the ttys file should be read again.  The shell process on
          each line that has become inactive according to ttys is ter-
          minated; a new process is created for each line added; lines
          unchanged in the file are undisturbed.  Thus it is possible
          to drop or add terminal lines without rebooting the system

     INIT(8)                                                   INIT(8)

          by changing the ttys file and sending a hangup signal to the
          init process: use `kill -1 1'.

          Init will terminate multi-user operations, kill all out-
          standing processes, and resume single-user mode if sent sig-
          nal SIGTERM: use `kill 1'.  Init will wait at most 30 sec-
          onds for outstanding processes to die, to avoid waiting for-
          ever.

          If, at bootstrap time, the init program cannot be executed,
          the system will loop in user mode at a low address.

     FILES
     SEE ALSO
          login(8), kill(1), sh(1), ttys(5), getty(8), rc(8),
          reboot(8)

     BUGS
          Init's multi-user functions should be integrated with the
          world of svcmgr(8).