Automatic Updates

Dexter23

Member
Dec 23, 2021
195
15
23
34
Hi everyone since i have a few server proxmox to manage, ill'ask yours if i can run a cronjob to do automatic updates on the server?
 
Code:
crontab -e

add

0 0 */10 * * /usr/bin/apt-get update && /usr/bin/apt-get -y dist-upgrade

Cron schedule (0 0 */10 * *)​

  • 0 0 */10 * *: This means the task is scheduled to run at midnight (00:00) every 10th dayof the month. Here's the breakdown:
    • 0: Minute (0th minute, meaning at the start of the hour)
    • 0: Hour (0th hour, meaning midnight)
    • */10: Every 10th day of the month (i.e., day 10, 20, 30, etc.)
    • *: Any month
    • *: Any day of the week

Command: /usr/bin/apt-get update && /usr/bin/apt-get -y dist-upgrade​

  • /usr/bin/apt-get update: This updates the list of available packages and versions from the repositories configured on the system.
  • &&: This ensures that the next command (apt-get dist-upgrade) runs only if the apt-get update command is successful.
  • /usr/bin/apt-get -y dist-upgrade: This upgrades all installed packages to the newest available versions. The -y flag automatically answers "yes" to prompts, so it can run unattended. The dist-upgrade command intelligently handles package dependencies and may install or remove packages as needed to complete the upgrade.

NEVER use apt-get upgrade this will break your Proxmox VE Host!

A quick article to that: https://www.thomas-krenn.com/de/wiki/Updates_(Minor)_in_Proxmox_VE_installieren
 
Last edited:
  • Like
Reactions: green72
i recommend and years using unattended-upgrades, and setup different times for different hosts
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!