diff --git a/README.md b/README.md index 90190de..95da168 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,12 @@ sudo curl -Lo /usr/local/sbin/gitea-updater -sSf https://gitea.illuad.fr/adrien/ sudo chmod 750 /usr/local/sbin/gitea-updater ``` +Create the logs' directory. + +``` +sudo mkdir -p /var/log/updater/gitea +``` + ## Configuration This script requires the configuration of 2 variables to work: `key` and `chat_id`. diff --git a/gitea-updater b/gitea-updater index 8e8ca83..99cc68c 100644 --- a/gitea-updater +++ b/gitea-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/gitea/gitea-$(date +%F).log 2>&1 + # abort on nonzero exitstatus set -o errexit @@ -32,8 +38,8 @@ function update_gitea { # set the correct permissions chmod +x /usr/local/bin/gitea - restorecon /usr/local/bin/gitea - restorecon /var/lib/gitea/log/gitea.log + /usr/sbin/restorecon /usr/local/bin/gitea + /usr/sbin/restorecon /var/lib/gitea/log/gitea.log if systemctl start gitea.service then