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:

If no -S option is specified, the shutdown type is read from $HOME/.ph/phshutdown.cfg, if it exists. This file contains the shutdown type selected the last time phshutdown was used. If this file doesn't exist, phshutdown uses the default type of reboot.

-u
Shut down without displaying the shutdown options dialog. This option may be useful for using phshutdown in a script.
-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 /usr/photon/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.

Files:

/usr/photon/config/phshutdown.restrict
The presence of this file prevents non-root users from shutting down or rebooting the machine.
$HOME/.ph/phshutdown.cfg
This file holds the type of shut down selected the last time phshutdown was used.

See also:

procnto, shutdown

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

shutdown_system() in the QNX Neutrino Library Reference