1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00

add logrotate

This commit is contained in:
Jean-Baptiste Holcroft 2019-08-23 08:32:02 +02:00
parent 5df42eb737
commit 6872223e5a
7 changed files with 39 additions and 1 deletions

View file

@ -30,4 +30,4 @@ StandardError=syslog
NotifyAccess=all NotifyAccess=all
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -7,6 +7,7 @@
# dependencies used by the app # dependencies used by the app
pkg_dependencies="libxml2-dev libxslt-dev libfreetype6-dev \ pkg_dependencies="libxml2-dev libxslt-dev libfreetype6-dev \
libjpeg-dev libz-dev libyaml-dev python3-dev python3-pip python3-virtualenv \ libjpeg-dev libz-dev libyaml-dev python3-dev python3-pip python3-virtualenv \
python3-enchant \
postgresql libpq-dev uwsgi uwsgi-plugin-python3 \ postgresql libpq-dev uwsgi uwsgi-plugin-python3 \
libpango1.0-dev libcairo2-dev libglib2.0-dev libgirepository1.0-dev \ libpango1.0-dev libcairo2-dev libglib2.0-dev libgirepository1.0-dev \
mailutils python-celery-common virtualenv redis-server" mailutils python-celery-common virtualenv redis-server"

View file

@ -61,6 +61,13 @@ ynh_backup "db.sql"
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_script_progression --message="Backing up logrotate configuration..." --time --weight=1
ynh_backup --src_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP THE CRON FILE # BACKUP THE CRON FILE
#================================================= #=================================================

View file

@ -300,6 +300,14 @@ chown -R "$app": "$final_path/data"
mkdir -p "$final_path/avatar-cache" mkdir -p "$final_path/avatar-cache"
chown -R "$app": "$final_path/avatar-cache" chown -R "$app": "$final_path/avatar-cache"
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --time --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate --logfile "/var/log/$app-celery"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================

View file

@ -79,6 +79,14 @@ ynh_script_progression --message="Removing nginx web server configuration..." --
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --time --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================

View file

@ -123,6 +123,12 @@ ynh_restore_file "/etc/cron.d/$app"
ynh_script_progression --message="Restore hub's binary file..." --time --weight=1 ynh_script_progression --message="Restore hub's binary file..." --time --weight=1
ynh_restore_file "/usr/bin/hub" ynh_restore_file "/usr/bin/hub"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -397,6 +397,14 @@ cp ../conf/cron "/etc/cron.d/$app"
ynh_replace_string "__APP__" "$app" "/etc/cron.d/$app" ynh_replace_string "__APP__" "$app" "/etc/cron.d/$app"
ynh_replace_string "__FINALPATH__" "$final_path/" "/etc/cron.d/$app" ynh_replace_string "__FINALPATH__" "$final_path/" "/etc/cron.d/$app"
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --logfile "/var/log/$app-celery" --non-append
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================