![]() Just like with the reboot example, this will turn the Linux computer off at 17:15, and once again you need to use the 24 time format. If you want to turn it off at a specific time. To reboot at exactly 11:00 P.M.: /sbin/shutdown -r 23:00 'rebooting at 11:00 P.M.' NOTE: your message will be broadcast to all active terminals / sessions. To reboot in 5 minutes: /sbin/shutdown -r 5 'reboot in five minutes'. That will enter a fifteen minutes delay after the issue of the command. Load of options to choose from but, to answer your question. shutdown -h nowĪnd if you want to do it with a delay. Here, the shutdown is the keyword Linux looks for while this command gets executed. So to turn off the computer at this very moment use this command. Though this command portrays another keyword, it exactly does the requirement asked for in a reboot command. In general you will need to root privileges to perform these commands (security control - prevents users from bringing a system down without privilege escalation) although if you really tire of typing sudo. ![]() The h stands for halt and the r for reboot. There are a number of options availabe, the easiest I have found for shutdown is sudo poweroff and for restart is sudo reboot. We are going to use the same shutdown command, just this time with h switch instead of r. man 5 crontab is pretty clear on how to use crontab to run a script on boot: These special time specification 'nicknames' are supported, which replace the 5 initial time and date fields, and are prefixed by the character: reboot : Run once after reboot. Let’s now write about shutdown instead of reboot. systemctl command : Systemd’s systemctl command can reboot or shutdown your server too. But it was for the greater good Two and a half months ago I posted about. This is pretty self explanatory, it will restart at 17:15 hours, be sure to use the 24 hours format. RHEL/CentOS Linux commands that we can use to restart the server carefully: shutdown command : All in one command to halt, power-off or reboot the machine. You might also want to reboot the computer at a specific time: shutdown -r 17:15 That command will reboot the computer 15 minutes after the issue of the command. If you already have permission to run reboot, then fine, just run reboot. It is used to do things that you might not otherwise have permission to do, but doesn't change what gets done. The r switch will That will reboot the computer inmediately, if you want to add a delay. It has no effect on the command itself (this being reboot ), it merely causes it to run as the super-user rather than as you. Additionally, the following command can be used to schedule a system reboot. Here’s how you’d use the command in this situation: sudo shutdown -r. You need to be root to be able to restart a Linux system, or you can use sudo (provided you are in the sudoers file) sudo rebootĪnother way to do it is to use shutdown command. sudo shutdown -r +timeInMinutes For example, the following command will reboot your system after 10 minutes: sudo shutdown -r +10. The shutdown command is used to shut down your system, but it can also be used to restart it if you provide the -r flag. ![]() Well it is actually one of the first things you learn when you administer servers via ssh, let’s start with restart. How to shutdown or reboot a Linux computer from the command line? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |