Skip to main content
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.
  1. To initiate a hard shutdown, create a systemd service unit file named /etc/systemd/system/force-shutoff.service with the following content:
  1. Next, create a systemd timer unit file named /etc/systemd/system/force-shutoff.timer to specify the shutdown schedule:
  1. Enable and start the timer service using the following command:
  1. 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:
  1. 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.