1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/borg_ynh.git synced 2024-09-03 18:16:05 +02:00

add logging conf

This commit is contained in:
Kay0u 2024-06-21 20:06:39 +02:00
parent 159bd111c6
commit d866d0fcaf
No known key found for this signature in database
GPG key ID: AE1DCADB6415A156
3 changed files with 31 additions and 2 deletions

23
conf/logging.conf Normal file
View file

@ -0,0 +1,23 @@
[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/__APP__/borg.log', 'a')
[formatter_logfile]
format=%(asctime)s %(levelname)s %(message)s
datefmt=
class=logging.Formatter

View file

@ -71,6 +71,9 @@ chown "$app:$app" "$install_dir/backup-with-borg"
ynh_add_config --template="sudoer" --destination="/etc/sudoers.d/$app"
chown root:root "/etc/sudoers.d/$app"
ynh_add_config --template="logging.conf" --destination="$install_dir/logging.conf"
chown "$app:$app" "$install_dir/logging.conf"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
@ -78,7 +81,7 @@ ynh_script_progression --message="Adding system configurations related to $app..
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed"
yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed" --log "/var/log/$app/borg.log"
# Disable the service, this is to prevent the service from being triggered at boot time
systemctl disable $app.service --quiet

View file

@ -93,6 +93,9 @@ chown "$app:$app" "$install_dir/backup-with-borg"
ynh_add_config --template="sudoer" --destination="/etc/sudoers.d/$app"
chown root:root "/etc/sudoers.d/$app"
ynh_add_config --template="logging.conf" --destination="$install_dir/logging.conf"
chown "$app:$app" "$install_dir/logging.conf"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
@ -100,7 +103,7 @@ ynh_script_progression --message="Upgrading system configurations related to $ap
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed"
yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed" --log "/var/log/$app/borg.log"
# Disable the service, this is to prevent the service from being triggered at boot time
systemctl disable $app.service --quiet