I am a new FreeBSD server user. How do I reboot or shutdown a FreeBSD based system? I tried shutdown -h 0 command. However, is not working for me on my BSD based system. How can I shutdown or reboot the server?
FreeBSD or other BSD families of operating systems use the shutdown or halt command to shutdown system. Use the reboot command to reboot the FreeBSD based system.
Shutdown FreeBSD command
Use the shutdown commandto close down the system at a given time. Type following command to shutdown system immediately. You must login as root user:
$ su -
$ sudo -i
Now shutdown the system at a given time:
# shutdown -h now
The -h option passed to halt the system. The time is the time at which shutdown ill bring the BSD system down and may be the case-insensitive word now (indicating an immediate shutdown) or a future time in one of two formats:
- +number – The first form brings the system down in number minutes and the second at the absolute time specified. +number may be specified in units other than minutes by appending the corresponding suffix: s/sec, m/min, and h/hour.
- yymmddhhmm - Where the year, month,and day may be defaulted to the current system values.
Halt the FreeBSD system in 10 minutes and show a warning message:
# shutdown -h +10 "System will shutdown for motherboard replacement."
Reboot BSD system
Type the following command as superuser/root user:
# shutdown -r now
The -r option to reboot the system at the specified time. Again you can specify time using the +number or yymmddhhmm format.
FreeBSD reboot the system
Say you want to reboot in 60 minutes and also need to display a warning message for all users currently logged in via ssh or other terminals. Therefore, try the following syntax:
# shutdown -r +60 "System will reboot for system ram upgrades."
shutdown command options for FreeBSD
- -h - The BSD system is halted at the specified time.
- -p - The FreeBSD system is shutodwn and the power is turned off (hardware support required) at the specified time.
- -r - The system is rebooted at the specified time.
- -k - Kick everybody off. The -k option does not actually halt the system, but leaves the system multi-user with logins disabled (for all but super-user).
- -o - If one of the -h, -p or -r options are specified, shutdown will execute halt(8) or reboot(8) instead of sending a signal to init(8).
- -n - If the -o option is specified, prevent the file system cache from being flushed by passing -n to halt(8) or reboot(8). This option should probably not be used.
Getting help on shutdown command
Simply type the following man command
A note about Permission denied and other error messages
You will get an error message that read as "permission denied" or "operation not permitted" on FreeBSD. To avoid these error messages always run shutdown and reboot command as the root user: