Created
April 13, 2020 06:05
-
-
Save ILMostro/e55b53a909eeffe45f932acd3db8a68d to your computer and use it in GitHub Desktop.
Borg backup systemd timer, service, and logging config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cat /etc/systemd/system/borgitup.service | |
[Unit] | |
Description=Create a backup using borg | |
[Service] | |
Type=oneshot | |
Environment=BORG_LOGGING_CONF=/etc/borg/logging.conf | |
; ExecStart=/usr/local/bin/borgitup | |
; 20200413 -- preprend a hyphen (-) to ignore error return value | |
; ExecStart=-/usr/local/bin/borgitup | |
; | |
; Alternatively, list the specific signals to consider as successful exit status | |
SuccessExitStatus=TEMPFAIL 250 SIGUSR1 1 | |
ExecStart=/usr/local/bin/borgitup | |
# cat /etc/systemd/system/borgitup.timer | |
[Unit] | |
Description=Create a weekly backup with borg | |
[Timer] | |
OnCalendar=weekly | |
Persistent=true | |
[Install] | |
WantedBy=timers.target | |
# cat /etc/borg/logging.conf | |
[loggers] | |
keys=root | |
[handlers] | |
keys=logfile | |
[formatters] | |
keys=logfile | |
[logger_root] | |
level=NOTSET | |
handlers=logfile | |
[handler_logfile] | |
class=FileHandler | |
level=INFO | |
formatter=logfile | |
args=('/var/log/borg.log', 'w') | |
[formatter_logfile] | |
format=%(asctime)s %(levelname)s %(message)s | |
datefmt= | |
class=logging.Formatter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Executes a simple bash script (
/usr/local/bin/borgitup
) to create weekly backup withborg
; implemented via systemd timer and service.