The letter A styled as Alchemists logo. lchemists Syndication Icon

Putin's War on Ukraine - Watch President Zelenskyy's speech and help Ukraine fight against the senseless cruelty of a dictator!

Published August 5, 2013 Updated May 7, 2022
Archiver Icon

Archiver

8.1.4

Provides customizable shell scripts for the automated backup of UNIX-based operation systems. These scripts are useful when you have available remote server storage you can backup your primary system too.

Features

  • Uses rsync for reliable, compressed, and fast backups.

  • Uses date/time-stamped backup folders by default.

  • Enforces backup limits so only a max number of backups can exist.

  • Supports automatic full and incremental backups.

  • Supports customizable settings for defining the local machine and remote server to backup to.

  • Supports customizable file manifest (include list) for defining what files and directories to backup.

Requirements

  1. A UNIX-system capable of running rsync.

  2. Knowledge of shells, scripting, cron, and SSH.

Setup

To install, run:

git clone https://github.com/bkuhlmann/archiver.git
cd archiver
git checkout 8.1.4

Usage

Type the following from the command line to run:

bin/run

Running the bin/run script will present the following options:

s: Setup current machine.
b: Backup to remote server.
c: Clean backups (enforces backup limit).
q: Quit/Exit.

The options prompt can be skipped by passing the desired option directly to the bin/run script. For example, executing bin/run s will perform setup for the current machine.

Configuration

Applying machine-specific settings is required prior to performing a backup. The shell script (see Usage section below for details) will install templates to get you started but will require further customization. The following is a breakdown of each setting file and how to use it:

  • $HOME/.config/archiver/settings.sh - Informs the Archiver how and where to perform the backup (see the settings/settings.sh.example file for examples). It consists of the following settings:

    • BACKUP_NAME - The name used for each backup (in this case a datetime). Example: 2013-01-15_10-30-55.

    • BACKUP_USER - The user account name used for both the current machine and backup server.

    • BACKUP_MACHINE - The name of machine to be backed up. This is also used to create the root folder for all machine backups and related logs.

    • BACKUP_SERVER - The backup server network name or IP address (where all backups will be stored).

    • BACKUP_ROOT - Root path for all backup folders on backup server for current machine.

    • BACKUP_LIMIT - The max number of backups to keep at a time.

  • $HOME/.config/archiver/manifest.txt - Defines all files to be backed up (include list). Use absolute file/directory paths based off the root directory (i.e. /). See the settings/manifest.txt.example file for examples.

Cron

Once backups are configured and running properly, add this script to your crontab for daily backup automation. Example:

- 1 - - - cd $HOME/Dropbox/Development/archiver && bin/run b 2>&1

…​which translates to running the script at 1am every morning.

SSH

To bypass the password prompt, install your public key on the backup server so cron does not have authentication issues when performing a backup (assuming you have a public key located at the following location):

~/.ssh/id_rsa.pub

…​you can then perform the following to install it on the backup server (assumes an authorized_key file does not already exists):

scp  ~/.ssh/id_rsa.pub archiver@archiver.local:.ssh/authorized_keys

That’s it!

For more info on SSH key generation, check out the GitHub Generating SSH Keys page.

Troubleshooting

  • SSH Connection Closed - If using a macOS backup server this will happen when the user you are logging in as doesn’t have remote access permission. Here are the steps to fix:

    • Login to the OSX backup server.

    • Open System Preferences

    • Click on Sharing.

    • Enable Remote Login and Remote Management for all users or just the users you want to allow for backup access.

  • Rsync Error 23 - If you see this in the backup log, it is most likely because the source file/directory no longer exists. Update your manifest.txt to fix accordingly.

Development

To contribute, run:

git clone https://github.com/bkuhlmann/archiver.git
cd archiver

Credits

Engineered by Brooke Kuhlmann.