To shutdown a Unix system, you can use the shutdown
command.
The shutdown
command is a utility that shuts down or reboots the system.
To shutdown a Unix system using the shutdown
command, you can use the -h
option to halt the system and the now
argument to shut it down immediately:
shutdown -h now
This will shut down the system immediately.
To shutdown a Unix system with a timeout, you can use the -h
option to halt the system and the +
followed by the number of minutes until shutdown to specify the timeout:
shutdown -h +10
This will shut down the system in 10 minutes.
To shutdown a Unix system and reboot it, you can use the -r
option to reboot the system and the now
argument to shut it down immediately:
shutdown -r now
This will shut down the system immediately and reboot it.
To shutdown a Unix system in a script, you can use the shutdown
command followed by the desired options and arguments:
shutdown -h now echo "System shutdown complete"
This will shut down the system immediately and print a message when the shutdown is complete.
Keep in mind that these are just a few examples of how to shutdown a Unix system. You can customize the options and arguments to meet the specific requirements of your script. You should also regularly review and update the script to ensure that it is correct and efficient.