Go-Zenon & Go-Hyperqube Backup & Restore Script
Easily back up and restore data for go-zenon
and go-hyperqube
with minimal downtime. The script manages key directories (nom
, network
, consensus
, cache
) and ensures you donβt run out of disk space.
Requirements
Root Access: Run with
sudo
.
Linux: Works on Debian/Ubuntu-based systems.
Disk Space: At least 10GB free in
/backup
(configurable).
Services: Must have
go-zenon
or go-hyperqube
installed via systemctl
.
Setup
Download the Script:
Script Link
Run one of the following:
wget -O backup_restore.sh https://gist.githubusercontent.com/0x3639/4f3cea99b06b428a326974103cdf0cbe/raw
OR
curl -o backup_restore.sh https://gist.githubusercontent.com/0x3639/4f3cea99b06b428a326974103cdf0cbe/raw
Make it Executable:
chmod +x backup_restore.sh
Verify Dependencies:
The script will auto-install tar
if missing (when run with sudo
).
Usage
Backup
sudo ./backup_restore.sh <service> --backup
Example:
sudo ./backup_restore.sh go-zenon --backup
What Happens?
- Stops the service
- Copies necessary data to
/backup/temp
- Restarts the service
- Creates a
.tar.gz
archive in/backup
- Verifies integrity (hash check)
- Deletes old backups (keeps the 5 most recent)
Restore
sudo ./backup_restore.sh <service> --restore
Example:
sudo ./backup_restore.sh go-hyperqube --restore
What Happens?
- Prompts for backup date (format:
MM-DD-YY
) - Finds the latest backup for that date
- Verifies integrity (hash check)
- Stops the service
- Moves existing data to
/backup/restore
(for rollback) - Extracts the backup
- Restarts the service
Configuration
Adjust settings inside the script:
- Disk Space: Change
MIN_FREE_SPACE
(default 5GB). - Backup Retention: Modify
MAX_BACKUPS
(default 5). - Storage Paths:
- Backups:
/backup
- Temporary:
/backup/temp
- Old Data:
/backup/restore
- Backups:
Notes
Missing folders (
cache
, etc.) are skipped (not an error).
Requires 10GB free space (2x
MIN_FREE_SPACE
) to proceed.
Always run with
sudo
to manage services.
This version keeps things concise, easy to follow, and action-oriented while ensuring users can quickly implement the backup & restore process.