Rebooting server in linux

Restart a Linux Server from the Command Line

Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.

While your Linux server can run continuously for weeks or months, some configuration tasks may require a manual system reboot. This guide shows you how to restart a Linux server over SSH, using PuTTY, or on your server’s console interface.

When Do I Need to Restart a Linux Server?

Generally, you do not need to regularly restart your Linux server. It should be able to keep running for weeks or months, without needing to be “refreshed” with a reboot.

However, several factors may make you want to restart your server. Some software installations require a manual reboot after installation, and some applications benefit from the system being periodically rebooted. There are also many administrative processes that require restarting the server for changes to take effect. Linode Compute Instances have a feature called Lassie (Linode Autonomous System Shutdown Intelligent rEbooter), also referred to as the Shutdown Watchdog. When this feature is enabled, a Compute Instance automatically reboots if it ever powers off unexpectedly. To have a normal reboot functionality, ensure that you have enabled this feature. For more information, see the Shutdown Watchdog guide.

For those cases and others, it is helpful to know the available commands to quickly initiate a graceful system reboot.

How Do I Restart a Linux Server from the Command Line?

In this section, you learn how to reboot your Linux server using the command line. These commands work whether you are connected directly to your server’s console or are connecting to it over SSH.

How to Restart a Linux Server with the reboot Command

The most straightforward way to restart your Linux server is with the reboot command.

This command starts a graceful shutdown, letting processes exit, temporary files are removed, and other system clean up tasks.

Читайте также:  Linux network file protocol

If you need to force a reboot, you can do so with the —force option. However, this should only be used when no other option is available. This option forces a reboot without allowing the usual clean up tasks, which can lead to loss and/or corruption of data.

How to Schedule a Restart on a Linux Server with the shutdown Command

The reboot command accomplishes the same system state as the shutdown command with the -r option and a schedule of now . The complete command is as follows:

You can safely use the above command and alter the time ( now ) to schedule when your Linux server restarts. For the time option, the shutdown command accepts either several minutes or a local time in 24-hour format. The command below, for example, schedules the server to reboot in 15 minutes.

The server then sends out a warning message to all logged-in users.

Broadcast message from root@localhost on pts/0 (Wed 2021-06-30 12:00:00 UTC): The system is going down for reboot at Wed 2021-06-30 12:15:00 UTC!

You can even send a custom message. In the example below, the server is scheduled to restart at 3:30 PM (local time), and a custom message is provided.

sudo shutdown -r 15:30 "Please wrap up your current tasks and save your work." 
Broadcast message from root@localhost on pts/0 (Wed 2021-06-30 19:15:00 UTC): Please wrap up your current tasks and save your work. The system is going down for reboot at Wed 2021-06-30 19:30:00 UTC!

Finally, you may want to cancel a scheduled reboot. You can do that with the following command:

How Do I Restart a Linux Server over PuTTY?

The process for restarting your Linux server over PuTTY is the same as above. The only difference is that you need to use PuTTY to open an SSH connection to your server.

If you are unsure how to do that, take a look at our guide on Connecting to a Remote Server Over SSH using PuTTY.

This page was originally published on Friday, August 6, 2021.

Источник

3 Easy Ways to Restart Ubuntu Server

You’ll learn various ways to restart Ubuntu server in this quick tutorial. The commands discussed here are generic and can be applied on any other Linux distribution.

To restart Ubuntu server immediately, you can use the reboot command:

I primarily use Ubuntu on almost all of my cloud services be it DigitalOcean or Linode. For a long time, I used Ubuntu as my desktop OS. The familiarity with the APT package manager made me more comfortable with Ubuntu as a server.

I am trying to share my experience with the server side on Linux Handbook, be it quick tip or a complicated task. This is a quick one where I am going to show you how to restart Ubuntu server in the terminal.

How to restart Ubuntu server

Since restarting a server is a critical task from functional point of view, only admin users can perform it. In other words, you need to have super user rights or use sudo in order to run the commands to restart or power off the system.

Читайте также:  Linux get free space

1. Use reboot command

If you want to restart Ubuntu server immediately, you can use this command:

If you don’t use the ‘now’ in the above command, it will reboot the system after a delay of one minute.

If for some reasons, your Ubuntu server is not restarting, you can try to force a reboot with option -f.

2. Use shutdown command

There are other ways as well. My preferred way is using the shutdown command in Linux. With the option -r, the shutdown command will reboot the system instead of just shutting down.

Instead of the now, you can give it a timestamp. 0 means immediate shutdown/reboot. You can also use the -H option that stands for halt. With this option, the system will first terminate all the processes and then shut down the CPU.

3. Use systemd command

Ubuntu uses systemd so you can also use systemd specific command for rebooting your server:

There could be several other ways but these three commands are easy to remember. So, the next time you need to restart Ubuntu server, you can do so easily without even looking up on the internet.

Источник

How to Restart or Reboot Linux Server from the Command Line

It’s a cliché, but true – restarting a Linux server solves a wide variety of issues.

When a system is rebooted, any malfunctioning software is purged from active memory. When the system restarts, it loads a fresh, clean copy of the software into active memory. Also, some operating systems require a restart to process updates or configuration changes.

This guide will show you how to restart a Linux server using only the command-line or prompt.

restart or reboot linux server from the command line

  • A system running a Linux operating system
  • Access to a command-line interface (also known as a terminal)
  • Root or sudo privileges
  • (optional) SSH software package for communicating with a remote server

Steps to Restart Linux using Command Prompt

Restarting Local Linux Operating System

Step 1: Open Terminal Window

If your version of Linux uses a graphical interface, you can open a terminal window by right-clicking the Desktop > left-clicking Open in terminal.

open terminal window in linux

You can also click the main menu (usually found in the lower-left or upper-left corner) and type in terminal in the search bar. Click on the Terminal icon, as in the image below.

search for terminal window in ubuntu

Step 2: Use the shutdown Command

Since powering off is one of the most basic functions of an operating system, this command should work for most distributions of Linux.

In a terminal window, type the following:

The sudo command tells Linux to run the command as an administrator, so you may need to type your password. The -r switch at the end indicates that you want the machine to restart.

Note: See our article for additional Linux shutdown command options.

Alternative Option: Restart Linux with reboot Command

Many Linux versions do not require administrator privileges to reboot. If you get a message that you do not have sufficient privileges, type:

Your system should close out of all open applications and restart.

Reboot Remote Linux Server

Step 1: Open Command Prompt

If you have a graphical interface, open the terminal by right-clicking the Desktop > left-clicking Open in terminal.

Читайте также:  Linux red hat межсетевой экран

You can also click the main menu (usually found in the lower-left or upper-left corner), and then click Applications > System Tools > Terminal.

If you prefer using a keyboard shortcut, press Ctrl+Alt+T.

Step 2: Use SSH Connection Issue reboot Command

In a terminal window, type:

ssh -t user@server.com 'sudo reboot'

Note: You may need to enter the password for the username you’ve used. Also, make sure you type the single-quote marks.

The ssh command tells your system to connect to another machine. The -t option forces the remote system to enter the command in a terminal. Replace user@server.com with the username @ server name that you want to restart.

The sudo reboot command can be switched out for sudo shutdown and the above options above can be used.

That is: -r tells it to restart, hh:mm sets a specific time, +mm sets a countdown.)

In this tutorial, you have learned how to restart a Linux server from the command prompt.

Rebooting a Linux system or server is designed to be simple, so you shouldn’t have any trouble. Just make sure you have saved all your work before restarting.

Источник

Как перезапустить или перезагрузить Linux сервер из командной строки

img

Это клише, но это правда — перезапуск сервера Linux решает множество проблем.

Когда система перезагружается, все неисправное программное обеспечение удаляется из активной памяти. Когда система перезагружается, она загружает новую чистую копию программного обеспечения в активную память. Кроме того, некоторые операционные системы требуют перезагрузки для обработки обновлений или изменений конфигурации.

Как перезапустить или перезагрузить Linux сервер из командной строки

Шаги по перезагрузке Linux с помощью командной строки

Перезапуск локальной операционной системы Linux

Шаг 1: откройте окно терминала

Open in terminal

Если в вашей версии Linux используется графический интерфейс, вы можете открыть окно терминала, щелкнув правой кнопкой мыши на рабочем столе и выбрав пункт Open in terminal (Открыть в терминале).

Вы также можете щелкнуть главное меню (обычно находится в нижнем левом или верхнем левом углу) и ввести terminal в строке поиска. Щелкните значок терминала, как показано на рисунке ниже.

terminal

Шаг 2. Используйте команду выключения

Поскольку отключение питания — одна из самых основных функций операционной системы, эта команда должна работать для большинства дистрибутивов Linux.

В окне терминала введите следующее:

Команда sudo указывает Linux запустить команду от имени администратора, поэтому вам может потребоваться ввести свой пароль. Ключ –r в конце указывает, что вы хотите перезапустить машину.

Альтернативный вариант: перезагрузить Linux с помощью команды reboot

Многие версии Linux не требуют прав администратора для перезагрузки. Если вы получили сообщение о том, что у вас недостаточно прав, введите:

Ваша система должна закрыть все открытые приложения и перезагрузиться.

Перезагрузить удаленный сервер Linux

Шаг 1. Откройте командную строку

Если у вас есть графический интерфейс, откройте терминал щелкнув правой кнопкой мыши на рабочем столе и выбрав пункт Open in terminal (Открыть в терминале), либо можете щелкнуть главное меню (обычно находится в нижнем левом или верхнем левом углу) и ввести terminal в строке поиска.

Если вы предпочитаете использовать сочетание клавиш, нажмите Ctrl + Alt + T ./p>

Источник

Оцените статью
Adblock
detector