Skip to content

Script for taking server and workstation backups and keeping them organised

License

Notifications You must be signed in to change notification settings

oranfry/simple-backups

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

Simple Backups

Script for taking server and workstation backups and keeping them organised

Installation

Copy bin/backup-server to /usr/local/bin or similar, and make executable.

Usage

Generally the tool must be run as root, because it works on files that could be owned by anyone. If your use case is simpler, it might work running as an unprivileged user.

To use the tool, set up at least one server, then run backup-server myserver.

Create the top-level backup folder (default /root/backup) and, within this, one folder for each server you want to back up. Name these server folders after the fully qualified hostnames of each server:

Each server folder needs a file called files.list listing all the patterns to be backed up.

/root
    /backup
        /example1.com
            /files.list
        /example2.com
            /files.list

Example files.list:

/etc/dnsmasq.conf
/etc/host*
/var/www/**

The wildcard syntax is basically taken from rsync, with the added advantage that intermediate paths are automatically filled in for you to make life easier.

Make sure you have ssh (rsync) access to the server you want to back up on the root account. On first run you may be prompted to accept the servers SSH fingerprint, so make sure to run and test manually before automating your backups.

Now that you have your servers configured, you can run backup-server example1.com or similar to back up. Repeat as needed - the archive will be replaced by the latest backup.

Backups will be placed next to the corresponding files.list, like so:

/root
    /backup
        /example1.com
            /files.list
            /backup.tar
        /example2.com
            /files.list
            /backup.tar

Options

backup-server

  -o OWNER          Specifies which user the backup tar file will owned by after creation (default: root)
  -p PARENT_DIR     The parent directory for backup config and tar files, relative to owner's home directory (default: backup)
  -z                If present, gzip the backup tar (filename will be backup.tar.gz)
  -s                If present, make an effort to save space on disk, at the cost of bandwidth and performance
  -v                If present, be noisy about what's going on

About

Script for taking server and workstation backups and keeping them organised

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages