Auto upgrade Proxmox VE (Script)
π One-Line Download & Execute:
clear && curl -fsSL https://docs.greenhome.stream/attachments/40 -o auto-upgrade-proxmox.sh && chmod +x auto-upgrade-proxmox.sh && clear && ./auto-upgrade-proxmox.sh
Hereβs aΒ clear step-by-step guide explaining what the auto-upgrade-proxmox.sh script does, and how you can set up cron jobs to:
- Run it daily at 03:00
- Run it weekly on Sundays at 04:00, and reboot the system if the script completes successfully.
π§ Script Purpose: What Does auto-upgrade-proxmox.sh Do?
This script is designed to automatically update your Proxmox system using apt.
β° How to Add Cron Jobs
To schedule this script, you need to edit the system crontab or the root user's crontab.
β οΈ Updates and reboots require root permissions, so make sure the script is owned by root and executable.
π§· Make Script Executable
sudo chmod +x /path/to/auto-upgrade-proxmox.sh
π Add Cron Jobs
Edit the root crontab:
sudo crontab -e
Add the following lines at the bottom:
# Daily at 03:00 β Run update only
0 3 * * * /path/to/auto-upgrade-proxmox.sh >> /var/log/auto-upgrade.log 2>&1
# Weekly on Sunday at 04:00 β Run update and reboot if successful
0 4 * * 0 /path/to/auto-upgrade-proxmox.sh && /sbin/reboot
π Explanation of Cron Syntax
| Field | Meaning |
|---|---|
0 3 * * * |
Every day at 03:00 AM |
0 4 * * 0 |
Every Sunday at 04:00 AM |
&& /sbin/reboot |
Only reboot if the script exits with success (code 0) |
β Summary
| Task | Schedule | Action |
|---|---|---|
| Run update script daily | 03:00 every day | Just updates and notifies |
| Weekly update + reboot | 04:00 Sundays | Updates, notifies, and reboots on success |
β Optional: Logging Output
You can monitor the scriptβs output in /var/log/auto-upgrade.log.
To ensure logs donβt grow indefinitely, consider adding log rotation or using logrotate.
Ins0mniA
No Comments