Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
How much do you know rebooting/shutting down your linux server?

* First of all you should be root or sudoer to be able to reboot the server.


The command below reboot the server immediately:

reboot

In case you want to reboot in a specific time, you can use shutdown command! Yes you have to use shutdown for rebooting server, it has historical reasons.

shutdown -r time "message"

time parameter can be now, or in the format of hh:mm, or in the format of +m which stands for minute. now is a shortcut for +0. The message part is the part that will be broadcast to all users who are logged in.

NOTE: shutdown command is recommended over reboot command.


So by the explanation given so far you can reboot your system after 5 minutes by the below command:

shutdown -r +5 "Server is going down for kernel upgrade. Please save your work ASAP."


To see last reboots history log:

last reboot


To reboot a remote server you can use ssh:

ssh root@server1 /sbin/reboot

#linux #cyberciti #reboot #shutdown #remote_reboot