Skip to content

AIV Standalone Backup and Restore Guide (Windows & Linux)

This guide provides step-by-step instructions for end users to backup and restore their Active Intelligence (AIV) standalone JAR installation on both Windows and Linux environments.

The AIV backup system runs as a parallel background process, ensuring that your dashboard data, uploaded reports, and system settings are fully protected without interrupting your running AIV application.


1. Prerequisites

Before running backup or restore operations, ensure:

  • PostgreSQL Client Utilities (pg_dump and pg_restore) are installed on the host and available in your shell PATH.
  • The system is running AIV Standalone via aiv.bat (Windows) or aiv.sh (Linux).
  • You have write access to the AIV directory.
  • (Linux only): Make sure the script files have execution permissions. Run this once inside backup-standalone to be safe:
    chmod +x *.sh

Step 1: Initial Configuration

Before running backups for the first time, you must verify that the backup settings match your database configuration.

  1. Navigate to the backup-standalone folder:
    • Windows: cd C:\aiv\backup-standalone (or your extracted standalone location)
    • Linux: cd /home/username/aiv/backup-standalone (or your extracted standalone location)
  2. Open the backup.conf file in a text editor.
  3. Verify and update the following settings:
    • PGDATABASE: Must match the database name in AIV’s active configuration (aiv by default).
    • PGPASSWORD: Must match your PostgreSQL database password.
    • REPO_PATH: Full path or relative path to the active repository folder.
    • BACKUP_ROOT: Full path or relative path to where you want to store your backup files.
    • MAX_BACKUPS: The number of historical backups you wish to retain (e.g., 24).

Example configuration (backup.conf):

PGHOST=localhost
PGPORT=5432
PGUSER=postgres
PGDATABASE=aiv
PGPASSWORD=root

# Windows Settings (Default)
# Uses relative paths assuming backup-standalone is inside your main AIV folder
REPO_PATH=..\repository
BACKUP_ROOT=..\backups

# Linux Settings (Comment Windows paths and uncomment these on Linux)
# REPO_PATH=../repository
# BACKUP_ROOT=../backups

MAX_BACKUPS=24
BACKUP_INTERVAL=3600

Step 2: Taking a One-Time Manual Backup

If you are about to perform maintenance, upgrades, or want to take an instant snapshot of your work:

Windows

  1. Open Command Prompt (cmd) and navigate to your standalone folder.
  2. Run:
    backup.bat

Linux

  1. Open your terminal and navigate to your standalone folder.
  2. Run:
    ./backup.sh

Once completed, a new folder will be created inside your backups directory named with the current timestamp (e.g., 2026-05-25_100106) containing db.dump (database dump) and repo.tar.gz (repository files).


Step 3: Scheduling Automated Hourly Backups

To keep your AIV files and database backed up every hour automatically in the background:

Windows

  1. Open Command Prompt (cmd) and navigate to the standalone folder.
  2. Start the hourly scheduler:
    start_scheduler.bat
    (This launches a minimized background window titled “AIV Backup Scheduler” that handles the hourly timer.)
  3. To stop automated backups:
    stop_scheduler.bat

Linux

  1. Open your terminal and navigate to the standalone folder.
  2. Start the hourly scheduler in the background:
    ./start_scheduler.sh
    (This starts the scheduler process in the background using nohup and saves the process ID inside scheduler.pid.)
  3. To stop automated backups:
    ./stop.sh

Step 4: Restoring from a Backup

[!WARNING] Restoring a backup will overwrite your current PostgreSQL database and AIV repository folder. Always make sure to take a manual backup beforehand just in case.

Windows

  1. Open Command Prompt (cmd) and navigate to your standalone folder.
  2. Run:
    restore.bat
  3. Enter the desired timestamp when prompted (e.g., 2026-05-25_100106) and press Enter.
  4. Type y to confirm the overwrite warning.

Linux

  1. Open your terminal and navigate to your standalone folder.
  2. Run:
    ./restore.sh
  3. Enter the desired timestamp when prompted and press Enter.
  4. Type y to confirm.

Important Final Step (Both Platforms)

Once the restore finishes successfully, restart the AIV application (aiv.bat on Windows or aiv.sh on Linux) so the Java server clears its memory cache and reads the newly restored database records!


Troubleshooting & Best Practices

  • Files are missing in the UI after restore: Make sure you restarted the AIV application after running the restore. AIV caches database structures in Java memory and requires a fresh start to sync properly with the newly restored database.
  • Backup script fails to find pg_dump or pg_restore: Ensure PostgreSQL client tools are installed and in your system’s PATH variables.
  • Scheduler is not running:
    • Windows: If the scheduler fails to start, verify if scheduler.lock exists in your folder. If it does, delete it manually and re-run start_scheduler.bat.
    • Linux: Check scheduler.log in the folder to see why the process stopped or didn’t launch.