Let journalctl be the log file maintainer

Fixes #3
This commit is contained in:
Erik Westrup
2018-08-26 15:54:35 +02:00
parent 8d023d0fe1
commit f50055f26a
4 changed files with 10 additions and 21 deletions
+8 -1
View File
@@ -51,7 +51,6 @@ Now see if the backup itself works, by running
```bash
$ /usr/local/sbin/restic_backup.sh
$ less /var/local/log/restic/*
$ restic snapshots
````
@@ -86,6 +85,14 @@ or start a backup manually
$ systemctl start restic-backup
```
You can follow the backup stdout output live as backup is running with:
```bash
$ journalctl -f -u restic-backup.service
````
(skip `-f` to see all backups that has run)
### 7. Email notification on failure
-9
View File
@@ -5,15 +5,6 @@
# Exit on failure, pipe failure
set -e -o pipefail
# Redirect stdout ( > ) into a named pipe ( >() ) running "tee" to a file, so we can observe the status by simply tailing the log file.
me=$(basename "$0")
now=$(date +%F_%R)
log_dir=/var/local/log/restic
log_file="${log_dir}/${now}_${me}.$$.log"
test -d $log_dir || mkdir -p $log_dir
exec > >(tee -i $log_file)
exec 2>&1
# Clean up lock if we are killed.
# If killed by systemd, like $(systemctl stop restic), then it kills the whole cgroup and all it's subprocesses.
# However if we kill this script ourselves, we need this trap that kills all subprocesses manually.
-9
View File
@@ -5,15 +5,6 @@
# Exit on failure, pipe failure
set -e -o pipefail
# Redirect stdout ( > ) into a named pipe ( >() ) running "tee" to a file, so we can observe the status by simply tailing the log file.
me=$(basename "$0")
now=$(date +%F_%R)
log_dir=/var/local/log/restic
log_file="${log_dir}/${now}_${me}.$$.log"
test -d $log_dir || mkdir -p $log_dir
exec > >(tee -i $log_file)
exec 2>&1
# Clean up lock if we are killed.
# If killed by systemd, like $(systemctl stop restic), then it kills the whole cgroup and all it's subprocesses.
# However if we kill this script ourselves, we need this trap that kills all subprocesses manually.