Documentation Restructure
All checks were successful
Automatic Documentation Deployment / Sync Docs to https://kb.bunny-lab.io (push) Successful in 5s

This commit is contained in:
2026-02-27 04:02:06 -07:00
parent 52e6f83418
commit 554c04aa32
201 changed files with 378 additions and 47 deletions

View File

@@ -0,0 +1,69 @@
---
tags:
- Proxmox
- Bash
- Scripting
- Linux
---
## Purpose
This script is ran via cronjob on `cluster-node-02` at midnight to rollback the deeplab environment automatically to a previous snapshot nightly.
### Bash Script
```sh title="/root/deeplab-rollback.sh"
#!/usr/bin/env bash
# ProxmoxVE Nightly DeepLab Rollback Script
SNAPNAME="ROLLBACK"
DC=140
WIN10=141
WIN11=111
ALL=("$DC" "$WIN10" "$WIN11")
log(){ echo "[$(date '+%F %T')] $*"; }
# Force Stop DeepLab VMs
for id in "${ALL[@]}"; do
log "Force stopping VM $id"
/usr/sbin/qm stop "$id" || true
done
# Rollback Snapshots
for id in "${ALL[@]}"; do
log "Rolling back VM $id to snapshot $SNAPNAME"
/usr/sbin/qm rollback "$id" "$SNAPNAME"
done
# Start DC
log "Starting DC ($DC)"
/usr/sbin/qm start "$DC"
# Wait 2 minutes
log "Waiting 2 minutes for DC to initialize..."
sleep 120
# Start Win10 + Win11
log "Starting WIN10 ($WIN10) and WIN11 ($WIN11)"
/usr/sbin/qm start "$WIN10" &
/usr/sbin/qm start "$WIN11" &
wait
log "Lab Rollback Complete."
```
### Crontab Scheduling
Type `crontab -e` to add an entry to run the job at midnight every day.
=== "With Logging"
``` sh
0 0 * * * /root/deeplab-rollback.sh >> /var/log/deeplab-rollback.log 2>&1
```
=== "Without Logging"
``` sh
0 0 * * * /root/deeplab-rollback.sh 2>&1
```