Shutdown Configuration
Configuring Auto Shutdown
Configure Pods for scheduled shutdown using systemd.
This guide explains how to set up automatic shutdown for a Pod using systemd
. systemd
is a system and service manager for Linux that provides a reliable and flexible way to manage services and tasks, including scheduled shutdowns.
We advise against using this feature for Pods running long-duration or overnight scripts, as it will forcibly terminate the Pod while the script is in progress.
- To initiate a hard shutdown, create a systemd service unit file named
/etc/systemd/system/force-shutoff.service
with the following content:
- Next, create a systemd timer unit file named
/etc/systemd/system/force-shutoff.timer
to specify the shutdown schedule:
- Enable and start the timer service using the following command:
- If you need to change the shutdown time in the future, update the time in
/etc/systemd/system/force-shutoff.timer
, and then reload all systemd configurations within the Pod by running:
- If you want to disable the scheduled shutdown in the future, use the following command:
By following these steps, you can configure your Pod to perform a scheduled hard shutdown using systemd. This ensures that your Pod shuts down automatically at the specified time, helping you manage resources efficiently.
Was this page helpful?