diff --git a/scripts/backup b/scripts/backup index e0b8bd7..6a99a4c 100644 --- a/scripts/backup +++ b/scripts/backup @@ -45,6 +45,12 @@ ynh_backup --src_path="$final_path" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # SPECIFIC BACKUP #================================================= diff --git a/scripts/install b/scripts/install index a492b67..40c33fb 100644 --- a/scripts/install +++ b/scripts/install @@ -148,6 +148,16 @@ ynh_systemd_action --service_name=$mongodb_servicename --action=restart sleep 10 +#================================================= +# GENERIC FINALIZATION +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." --weight=1 + +# Use logrotate to manage application logfile(s) +ynh_use_logrotate + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/remove b/scripts/remove index d37f8d1..33b029f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -43,6 +43,14 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 + +# Remove the app-specific logrotate config +ynh_remove_logrotate + #================================================= # REMOVE THE MONGODB DATABASE #================================================= diff --git a/scripts/restore b/scripts/restore index e195f55..cc6f762 100644 --- a/scripts/restore +++ b/scripts/restore @@ -96,6 +96,13 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 271d32b..07d9236 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -131,6 +131,14 @@ ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --targ # Create a dedicated systemd config ynh_add_systemd_config +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 + +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + #================================================= # MODIFY A CONFIG FILE #=================================================