Automating Daily Restarts for Proxmox LXC Containers


In the world of server management, ensuring the smooth operation of your containers is key. Sometimes, a simple restart can be the best solution for a range of minor issues, or maybe you have a use case that requires a fresh start every day. Whatever the reason, automating this process on a Proxmox server is both efficient and easy. In this post, I will guide you through setting up a daily restart for your Proxmox LXC containers using cron jobs.

What is a Cron Job?

Cron is a time-based job scheduler in Unix-like operating systems. It allows you to run scripts or commands at a scheduled time and is perfect for automating routine tasks like restarting a container.

Setting up the Cron Job

  1. Log into Your Proxmox Server Start by logging into your Proxmox server. You can do this via SSH.
  2. Edit the Crontab File Once logged in, open the crontab file for editing by entering crontab -e in the terminal.
  3. Create Your Cron Job In the crontab file, you’ll schedule the restart. For example, to restart your container every day at 3 AM, add the following line:
0 3 * * * pct stop [VMID] && pct start [VMID]

Replace [VMID] with the ID of your LXC container. This command will first stop and then start the container at the specified time.

  1. Save and Exit After adding the line, save and close the crontab file. Your cron job is now set up.

Things to Remember

  • Container Readiness: Ensure that your container is configured to handle restarts without issues. This is especially important for containers running critical services.
  • Timezone Awareness: Cron uses the server’s timezone. Make sure you’re scheduling the restart according to the correct timezone.
  • Logging: It might be beneficial to log the restarts. You can redirect the output of the cron job to a log file for record-keeping.


Setting up a daily restart for your LXC containers in Proxmox using cron jobs is a straightforward process that can significantly aid in routine maintenance and stability. Just a few simple steps in the terminal, and you’re all set for automated restarts.