Backup & Restore Script to go-zenon and go-hyperqube

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.


:wrench: Requirements

:white_check_mark: Root Access: Run with sudo.
:white_check_mark: Linux: Works on Debian/Ubuntu-based systems.
:white_check_mark: Disk Space: At least 10GB free in /backup (configurable).
:white_check_mark: Services: Must have go-zenon or go-hyperqube installed via systemctl.


:inbox_tray: Setup

:one: Download the Script:
:pushpin: 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

:two: Make it Executable:

chmod +x backup_restore.sh

:three: Verify Dependencies:
The script will auto-install tar if missing (when run with sudo).


:rocket: Usage

:pushpin: Backup

sudo ./backup_restore.sh <service> --backup

:small_blue_diamond: Example:

sudo ./backup_restore.sh go-zenon --backup

:white_check_mark: 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)

:pushpin: Restore

sudo ./backup_restore.sh <service> --restore

:small_blue_diamond: Example:

sudo ./backup_restore.sh go-hyperqube --restore

:white_check_mark: 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

:gear: Configuration

:hammer_and_wrench: 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

:memo: Notes

:small_blue_diamond: Missing folders (cache, etc.) are skipped (not an error).
:small_blue_diamond: Requires 10GB free space (2x MIN_FREE_SPACE) to proceed.
:small_blue_diamond: 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. :rocket: