Restarting a Server via SSH
sudo shutdown -r now
<===> Toto RESTARTUJE! PC okamzite // With this command it’s possible to schedule a shutdown or restart for a future time, and you can choose between shutting down or restarting the server. To immediately reboot the server (much like with the reboot command),sudo shutdown now
<===> Toto VYPNE!! PC okamzite
reboot
<===> this will only work if you have the necessary permissions. Ordinarily this requires you login in as root, or a user that’s been given root privileges. Keep in mind that th “reboot” command will reboot the server right away, by telling all processes to gracefully save their work and exit.
## Beyond the simple “reboot” command, there are several other ways to restart a server while connected to SSH. For example, you might use these if you want to reboot or shutdown the server at a scheduled time. The relevant commands include shutdown, init, and systemctl.
init 6
<===> This command can be used to shut down and restart the server, as well as to perform other tasks related to the initialization process. Again, to behave the same way as the “reboot” command, the following example uses init to reboot the server immediatelysystemctl reboot
<===> systemctl is commonly used to start, stop, or restart different system services, but it can also be used to reboot the server entirely. Again, to immediately reboot the server the same way the “reboot” command does, you can use systemctl
systemctl poweroff
<===> vypne pcsudo poweroff
<===> vypne pc pri vzdalenem ovladani
shutdown -h now
<===> pokud pocitac po shozeni najede jen do stavu "Give root password for maintenance" je nutne zadavat -h coz ho vypne // Default for shutdown is to switch to run level 1 (maintenance).