From d3de9f36aaa898a6423433b116a6a39102e29d2b Mon Sep 17 00:00:00 2001 From: adrien Date: Mon, 25 Jan 2021 14:56:42 +0100 Subject: [PATCH] Add log functionality --- README.md | 6 ++++++ bw-updater | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index deeaa23..408b8fe 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,12 @@ sudo curl -Lo /usr/local/sbin/bw-updater -sSf https://gitea.illuad.fr/adrien/bw- sudo chmod 750 /usr/local/sbin/bw-updater ``` +Create the logs' directory. + +``` +sudo mkdir -p /var/log/updater/bitwarden +``` + ## Configuration This script requires the configuration of 3 variables to work: `key`, `chat_id` and `username`. diff --git a/bw-updater b/bw-updater index 351e6c2..bf5c4ad 100644 --- a/bw-updater +++ b/bw-updater @@ -1,5 +1,11 @@ #! /usr/bin/env bash +# all executed commands are printed to stdout +set -x + +# redirect stdout (and stderr to stdout) to a file +exec 1> /var/log/updater/bitwarden/bitwarden-$(date +%F).log 2>&1 + # abort on nonzero exitstatus set -o errexit