How do I shutdown or poweroff a UNIX computer system from a shell prompt?
You can use the halt, poweroff, and shutdown UNIX command line utilities. These command write any pending information to the disks and then stop the processor. The poweroff utility has the machine remove power, if possible. To shutdown UNIX computer immediately type the following command as the root user:
In this example, shutdown is being executed and is scheduled in 120 seconds. The warning message is output 2 minutes:
# shutdown -y -i 5 -g 120 "===== Disk replacement ====="
Under System V based systems, enter:
# shutdown -y -i 0 -g 10
- -y : Pre-answer the confirmation question so the command can be run without user intervention.
- -i init_Level : If there are warnings, init-state specifies the state init is to be in. By default, system state s (single user mode) is used. The -i 5 will shut the machine down so that it is safe to remove the power. The -i 0 will take into firmware on Sun and a few other Unix hardware.
- -g graceTime : Allow the super user to change the number of seconds from the 60-second default.
To halt the HP-UX unix server system in 10 minutes (600 seconds) with no interactive questions and answers, enter as the root user:
# shutdown -h -y 300