phshutdown

Shut down and reboot the system (QNX Neutrino)

Syntax:

phshutdown [options] 

Runs on:

Neutrino

Options:

-f
Shut down fast. Send a SIGTERM signal, but wait only one second before rebooting.
-i
Ignore superuser (root) privileges.
-n nodename
Shut down the specified node (default is current node).
-q
Be quiet.
-S type
The type of shutdown, which must be one of:

The default is reboot.

-v
Be verbose.

Description:

In its default configuration, phshutdown allows any user to shut the system down. This makes it easy to use in a single-user desktop environment but is not desirable in a multi-user, networked configuration. If you want to make it more secure, restrict this shutdown privilege to root by simply creating a new file, like this:

$ touch $PHOTON2_PATH/config/phshutdown.restrict

The presence of this file allows any user to end a Photon session, but prevents users who do not have the root password from shutting down or rebooting the machine.

If you are root, this restriction does not apply unless you pass the -i option with phshutdown. In this case, you are treated as a non-root user and will be asked for the root password before being allowed to shut the system down. Using this option always provides a secure shutdown dialog, even from phlogin, where it's always root that launches phshutdown.


Note: This utility needs to have the setuid ("set user ID") bit set in its permissions. If you use mkefs, mketfs, or mkifs on a Windows host to include this utility in an image, use the perms attribute to specify its permissions explicitly, and the uid and gid attributes to set the ownership correctly.

The phshutdown utility displays a dialog of shutdown options:

phshutdown options

If you choose to shut down the entire system, phshutdown does it in an orderly way by:

  1. Causing a SIGTERM signal to be sent to all processes listed under /proc
  2. Waiting for ten seconds (or one second if the -f option is specified)
  3. Causing a SIGKILL signal to be sent to all remaining processes
  4. Rebooting the system.

The ten-second interval allows processes that have elected to catch the SIGTERM signal to perform any cleanup they need to do before the system is rebooted.

If you decide to shutdown or reboot the system, phshutdown adds a a line to the /var/log/wtmp if it already exists.


Note: The phshutdown utility doesn't create /var/log/wtmp if it doesn't already exist. This file can quickly become very big, which isn't good on an embedded system with limited resources.

Files:

$PHOTON2_PATH/config/phshutdown.restrict
The presence of this file prevents non-root users from shutting down or rebooting the machine.
/var/log/wtmp
If you shutdown or reboot the system, and this file already exists, a log entry is added to it.

See also:

procnto, shutdown

Logging In, Logging Out, and Shutting Down in the Neutrino User's Guide