Scheduling a server shutdown
Please use the “Print” function at the bottom of the page to create a PDF.
Valid for: Dedicated Servers and Bare Metal Servers running Ubuntu 22.04, Ubuntu 24.04, Ubuntu 26.04, Debian 12, Debian 13, AlmaLinux 9, AlmaLinux 10, Rocky Linux 9, and Rocky Linux 10
This article explains how to schedule a shutdown of your Dedicated Server or Bare Metal Server running Linux to prevent data loss during maintenance work.
Before scheduled maintenance work (e.g. when a faulty hard drive is replaced) or before your server is moved, we recommend scheduling a shutdown of your server to prevent data loss.
Note
The commands in this article work on all the distributions listed above. Only the command for restarting the time synchronisation service differs: Ubuntu 22.04, Ubuntu 24.04, Debian 12, and Debian 13 use systemd-timesyncd by default, while Ubuntu 26.04, AlmaLinux, and Rocky Linux use chrony. The commands for both services are listed below.
Caution
If you schedule a shutdown for a Dedicated Server or Bare Metal Server that is managed in Server Management, only IONOS Customer Service can start it again. This also applies to servers that were purchased as part of a Server Deal and are managed in Server Management.
- Log in to the server as an administrator.
To check the system time and the status of the time synchronisation, enter the following command:
root@host:~# timedatectl status
Check the time displayed in the Local time line.
Make sure that the System clock synchronized line shows yes.
If the time is incorrect, restart the time synchronisation service. To do this, enter the command for your distribution:
Ubuntu 22.04, Ubuntu 24.04, Debian 12, and Debian 13
root@host:~# systemctl restart systemd-timesyncd
Ubuntu 26.04
root@host:~# systemctl restart chrony
AlmaLinux 9, AlmaLinux 10, Rocky Linux 9, and Rocky Linux 10
[root@host ~]# systemctl restart chronyd
To set the time at which the server is to shut down, enter one of the following commands:
Shut down the server in two hours:
root@host:~# shutdown -h +120
Shut down the server at a specific time (24-hour format):
root@host:~# shutdown -h hh:mm
Example:
root@host:~# shutdown -h 23:00
Shut down the server at a specific time on a specific day:
root@host:~# shutdown -h +$(($(date +%s -d "YYYY-MM-DD hh:mm") / 60 - $(date +%s) / 60))
Example:
root@host:~# shutdown -h +$(($(date +%s -d "2026-06-10 22:30") / 60 - $(date +%s) / 60))
Caution
If you restart the server before the scheduled time, the scheduled shutdown is cancelled. In this case, enter the command again. The server then shuts down automatically at the specified time.
Cancelling a scheduled shutdown
To cancel a scheduled shutdown, enter the following command:
root@host:~# shutdown -c