# Auto upgrade Proxmox VE (Script)

#### 🚀 One-Line Download &amp; 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 `<strong>auto-upgrade-proxmox.sh</strong>` 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

```bash
sudo chmod +x /path/to/auto-upgrade-proxmox.sh
```

---

#### 📆 Add Cron Jobs

Edit the **root crontab**:

```bash
sudo crontab -e
```

Add the following lines at the bottom:

```bash
# 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

<table id="bkmrk-field-meaning-0-3-%2A-"><thead><tr><th>Field</th><th>Meaning</th></tr></thead><tbody><tr><td>`0 3 * * *`</td><td>Every day at **03:00 AM**</td></tr><tr><td>`0 4 * * 0`</td><td>Every **Sunday at 04:00 AM**</td></tr><tr><td>`&& /sbin/reboot`</td><td>Only reboot if the script exits with success (code 0)</td></tr></tbody></table>

---

#### ✅ Summary

<table id="bkmrk-task-schedule-action"><thead><tr><th>Task</th><th>Schedule</th><th>Action</th></tr></thead><tbody><tr><td>Run update script daily</td><td>03:00 every day</td><td>Just updates and notifies</td></tr><tr><td>Weekly update + reboot</td><td>04:00 Sundays</td><td>Updates, notifies, and reboots on success</td></tr></tbody></table>

---

#### ✅ Optional: Logging Output

You can monitor the script’s output in `<strong>/var/log/auto-upgrade.log</strong>`.

To ensure logs don’t grow indefinitely, consider adding log rotation or using `<strong>logrotate</strong>`.

---

<span style="color: rgb(224, 62, 45);">**Ins0mniA**</span>