diff --git a/NEWS b/NEWS index 724a7c72..3dc98c5b 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ 1.0.3-dev * #18: Fix for README mention of sample files not included in package. + * #22: Sample files for triggering borgmatic from a systemd timer. * Added logo. 1.0.3 diff --git a/README.md b/README.md index 00c2b97a..4d7f18ee 100644 --- a/README.md +++ b/README.md @@ -119,12 +119,33 @@ If you'd like to see the available command-line arguments, view the help: ## Autopilot If you want to run borgmatic automatically, say once a day, the you can -configure a job runner like cron to invoke it periodically. Download the -[sample cron -file](https://torsion.org/hg/borgmatic/raw-file/tip/sample/borgmatic.cron). +configure a job runner to invoke it periodically. + +### cron + +If you're using cron, download the [sample cron +file](https://torsion.org/hg/borgmatic/raw-file/tip/sample/cron/borgmatic). Then, from the directory where you downloaded it: - sudo cp borgmatic.cron /etc/cron.d/borgmatic + sudo mv borgmatic /etc/cron.d/borgmatic + +You can modify the cron file if you'd like to run borgmatic more or less frequently. + +### systemd + +If you're using systemd instead of cron to run jobs, download the [sample +systemd service +file](https://torsion.org/hg/borgmatic/raw-file/tip/sample/systemd/borgmatic.service) +and the [sample systemd timer +file](https://torsion.org/hg/borgmatic/raw-file/tip/sample/systemd/borgmatic.timer). +Then, from the directory where you downloaded them: + + sudo mv {borgmatic.service,borgmatic.timer} /etc/systemd/system/ + sudo systemctl enable borgmatic.timer + sudo systemctl start borgmatic.timer + +Feel free to modify the timer file based on how frequently you'd like +borgmatic to run. ## Running tests diff --git a/sample/borgmatic.cron b/sample/cron/borgmatic similarity index 100% rename from sample/borgmatic.cron rename to sample/cron/borgmatic diff --git a/sample/systemd/borgmatic.service b/sample/systemd/borgmatic.service new file mode 100644 index 00000000..443b1f0d --- /dev/null +++ b/sample/systemd/borgmatic.service @@ -0,0 +1,6 @@ +[Unit] +Description=borgmatic backup + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/borgmatic diff --git a/sample/systemd/borgmatic.timer b/sample/systemd/borgmatic.timer new file mode 100644 index 00000000..4b49d1f7 --- /dev/null +++ b/sample/systemd/borgmatic.timer @@ -0,0 +1,8 @@ +[Unit] +Description=Run borgmatic backup + +[Timer] +OnCalendar=daily + +[Install] +WantedBy=timers.target