Skip to main content

Automatically create backups of a directory

Project description

autobackup

Usage

Installation

Install latest from the GitHub repository:

$ pip install git+https://github.com/johnowhitaker/autobackup.git

or from pypi

$ pip install autobackup

How to use

autobackup src dest will make a copy of src (which can be a file or a directory) inside dir in a folder with the current date+time, and clean up any old backups based on the following rules:

  • The most recent 5 backups are kept
  • For each number of days in --max_ages (default is “2,14,60”) the oldest one below that age is kept.

This ensures that you have a few recent backups, one up to 2 days old, one up to 2 weeks old and one up to 2 months old.

To run this script hourly,

  1. Create a service file (e.g. /etc/systemd/system/backup.service):
[Unit]
Description=Hourly Backup Service

[Service]
ExecStart=autobackup /path/to/src /path/to/dest

[Install]
WantedBy=multi-user.target
  1. Create a timer file (e.g. /etc/systemd/system/backup.timer):
[Unit]
Description=Run Backup Service Hourly

[Timer]
OnCalendar=hourly

[Install]
WantedBy=timers.target
  1. Enable and start the timer:
sudo systemctl enable backup.timer
sudo systemctl start backup.timer

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autobackup-0.0.4.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autobackup-0.0.4-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file autobackup-0.0.4.tar.gz.

File metadata

  • Download URL: autobackup-0.0.4.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for autobackup-0.0.4.tar.gz
Algorithm Hash digest
SHA256 256b56319c5a424904548e4850a785e8d0930d534cc4fd9a614652ceef2a4fa7
MD5 937941992aac7131a4a0b35d741457bd
BLAKE2b-256 836ea7036afc03b7864194ab3bae7949fd0c6981de98305cee967ffe280f5137

See more details on using hashes here.

File details

Details for the file autobackup-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: autobackup-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for autobackup-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fcd6a940eca23b4a7f12ae37451a94027a5c0ac9ef6a1748f5ad1e5b9554f810
MD5 bd2d6b3d582be0f9152513d537e00f35
BLAKE2b-256 a85b241f903e42d353f44e86f28697d9502687da793a3d592f9f2a80b20ea7f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page