diff --git a/scripts/backup b/scripts/backup index 45852ba..1f62fcb 100644 --- a/scripts/backup +++ b/scripts/backup @@ -61,6 +61,12 @@ ynh_backup --src_path="$data_path" --is_big ynh_backup --src_path="/etc/systemd/system/$app.service" +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 7bb7bc7..5c20468 100644 --- a/scripts/install +++ b/scripts/install @@ -134,12 +134,20 @@ ynh_add_systemd_config ynh_script_progression --message="Modifying a config file..." --weight=1 ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config/config.json" +chmod 600 $final_path/config/config.json +chown $app:$app $final_path/config/config.json chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -chmod 600 $final_path/config/config.json -chown $app:$app $final_path/config/config.json + +#================================================= +# 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 f3a5055..cc046b2 100644 --- a/scripts/remove +++ b/scripts/remove @@ -41,6 +41,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 DEPENDENCIES #================================================= diff --git a/scripts/restore b/scripts/restore index 88403bb..f19fb9f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -107,6 +107,13 @@ ynh_script_progression --message="Starting a systemd service..." --weight=40 ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Ready for requests!" +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d404251..f302e7f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -137,6 +137,14 @@ ynh_script_progression --message="Modifying a config file..." --weight=2 ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config/config.json" chmod 600 $final_path/config/config.json +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 + +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + #================================================= # INTEGRATE SERVICE IN YUNOHOST #=================================================