Node Backup and Update with check build

From DXSpider Documentation Wiki
Revision as of 16:55, 9 April 2025 by EA3CV (talk | contribs) (Created page with " = πŸ› οΈ Node Backup and Update with check_build = == πŸ“‹ Description == The `check_build` command is a DXSpider utility script that checks for new builds (updates) in the MOJO branch. If a new build is available, it can: * Perform a full backup of the current node installation * Retain previous backup archives * Automatically update the node (Git hard reset + pull) This tool does not aim to replace the standard `git` update method, but is especially useful for sys...")
(diff) ← Older revision | Latest revision (diff) | Newer revision β†’ (diff)
Jump to navigation Jump to search

πŸ› οΈ Node Backup and Update with check_build

πŸ“‹ Description

The `check_build` command is a DXSpider utility script that checks for new builds (updates) in the MOJO branch. If a new build is available, it can:

  • Perform a full backup of the current node installation
  • Retain previous backup archives
  • Automatically update the node (Git hard reset + pull)

This tool does not aim to replace the standard `git` update method, but is especially useful for sysops who are cautious about updates potentially breaking their nodes. In case of failure, a full backup ensures the service can be restored quickly.

The script can be run manually from the DXSpider shell or scheduled via `crontab`.

βš™οΈ Features

  • Verifies if a newer build is available on the remote repository.
  • If backup is enabled:
    • Creates a full backup using `rsync`
    • Compresses it as `spider.YYYYMMDD.HHMMSS.tar.gz`
    • Retains up to a configurable number of backup files
  • Performs a full Git reset and update
  • Optionally notifies via Telegram if configured

▢️ Usage

From the DXSpider shell:

check_build <Y/N> <num_backups>

Where:

  • `Y` = Enable backup before updating
  • `N` = Update without backup
  • `num_backups` = Number of backups to retain (default: 10)

πŸ•’ Example crontab configuration

Run the command Monday to Friday at 04:00 with backup enabled, keeping 7 backups:

0 4 * * 1,2,3,4,5 run_cmd("check_build Y 7")

Update the script daily (thanks to G6NHU) with:

30 0 * * * spawn('cd /spider/local_cmd; wget -qN https://raw.githubusercontent.com/EA3CV/dxspider_info/main/check_build.pl -O /spider/local_cmd/check_build.pl') 32 0 * * * run_cmd('load/cmd')

πŸ’Ύ Installation

Download the script from the official repository:

View on GitHub - check_build.pl

Save it as:

/spider/local_cmd/check_build.pl

πŸ”„ Restoring a backup

If something goes wrong during the update:

1. Locate the latest backup archive in `/home/sysop/spider.backup`

2. Decompress it:

cd /home/sysop
tar -xzvf spider.backup/spider.YYYYMMDD.HHMMSS.tar.gz

3. Replace the current `/spider` directory with the extracted backup

4. Restart DXSpider

βͺ Alternative: Using undo_newbuild.pl

If installed, the `undo_newbuild.pl` script allows you to quickly restore the most recent backup made by `check_build`.

Simply run:

set/undo_newbuild

This command will:

  • Locate the latest backup archive in `/home/sysop/spider.backup`
  • Decompress and restore it
  • Restart the node automatically

πŸ“₯ Download

You can download the script from the repository:

View on GitHub - undo_newbuild.pl

Save it as:

/spider/local_cmd/undo_newbuild.pl

πŸ“¦ Dependencies

This script requires:

  • Git
  • rsync

To install `rsync` on Debian-based systems:

apt install rsync

πŸ“² Telegram integration (optional)

If the `telegram()` function is defined in `Local.pm` and Telegram bot variables (`$id`, `$token`) are set in `DXVars.pm`, the script will send notifications when:

  • A backup starts
  • A backup completes

For full setup instructions, see: Sending messages to the sysop via Telegram

🧠 Notes

  • Only supports the **MOJO branch** of DXSpider.
  • Backup directory: `/home/sysop/spider.backup`
  • Automatically excludes heavy folders: debug logs, spots, wwv, wcy, etc.
  • Recommended for sysops who want to automate update and backup tasks with minimal risk.

πŸ‘¨β€πŸ’» Author