Use the absolute path of the restorecon binary and add log functionality

This commit is contained in:
adrien 2021-01-25 15:04:11 +01:00
parent 8a2e6ec1a0
commit 6678e7ff92
2 changed files with 14 additions and 2 deletions

View File

@ -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`.

View File

@ -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