Quick Tip: Know Your Linux Server Shutdowns
Every once in a while, you’ll need to either shutdown or reboot your virtual private server (VPS). Whether it’s completely expected or because of some major issue that can’t be resolved otherwise, you’ll want to know some best practices before it becomes necessary.
The good news is that it’s hard to harm a VPS the way you might harm your desktop computer by initiating a reboot via a case button or by yanking out the power cord.
All of these commands are invoked from a user account with
sudo access rather than root itself; for more information, visit our SSH guide.
Get THE BEST DEALS IN CLOUD HOSTING from Los Angeles!Grab a huge 32GB RAM & 320GB of SSD storage for just $109/year!
Perhaps the most common is the reboot.
$ sudo shutdown -r now
It’s possible to leave a small note about why the reboot is happening in logs.
$ sudo shutdown -r now 'Rebooting because I feel like it'
You can also invoke
$ sudo reboot
You can also shutdown the server immediately.
$ sudo shutdown -h now
Or, at a specific time, or after a certain amount of time has passed.
$ sudo shutdown 8:00 $ sudo shutdown +15
If you accidentally initiate a shutdown, you just might be able to halt it.
Graceful vs. forceful
All of the above commands operate in slightly different ways depending on which Linux distribution you work with, but they generally respect the need to gracefully exit running services/daemons before initiating the actual shutdown. There is one exception, only to be used in dire circumstances, as it immediately and forcefully reboots the VPS:
reboot -f -r now
Just remember: graceful is good, and don’t get too caught up in the never-ending debate over whether
reboot is the “superior” command.
This is just the first of many quick tips that we'll be running every Friday, covering Linux administration and managing a VPS. Have something you want us to cover? Let us know in the comments or [get in touch](https://www.ssdnodes.com/contact-us/).