GithubHelp home page GithubHelp logo

cdroege / systemd-restic-simple Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 5 KB

Simple systemd Service Units Files for Restic

systemd restic-backups systemd-service systemd-timer backup backup-script restic

systemd-restic-simple's Introduction

Simple systemd Service Units Files for Restic

This repository contains some simple restic systemd service unit files to manage daily backups with restic. There are also other approaches for this:

There are a few differences compared to the other approaches. The service files restrict the permissions, e.g. restic runs as a stand-alone user with only read access to the whole file system. Additionally, the user that runs restic is created dynamically (so no sysuser.d file is needed) and the cache directory is also handled in the service file itself. To use the service files, it is not required to install additional scripts.

Prerequisites

  • systemd as the init system
  • restic
  • an initialized restic repo. You can create one with the following command:
restic init --repo $RESTIC_REPOSITORY

Installation

Copy the service files to /etc/systemd/system/ and the configuration files to /etc/restic/

git clone https://github.com/cdroege/systemd-restic-simple.git
cd systemd-restic-simple
sudo cp restic-* /etc/systemd/system/
sudo cp -r etc/restic /etc/
sudo chmod 600 /etc/restic/restic.conf

To configure restic you can change the sample restic.conf. You can set every environment variable that is supported by restic here. For example, the RESTIC_REPOSITORY variable can be used to specify a restic repository where restic should save the backup data (see Preparing a new repository). You can also exclude some files and directory in your backups with the supplied exclude-file.conf.

The timer unit always performs a daily backup. You can enable it as follows:

sudo systemctl enable --now restic-backup.timer

To see the status of the backup you can execute the following command:

sudo journalctl -u restic-backup -f

systemd-restic-simple's People

Contributors

cdroege avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.