diff --git a/scripts/backup b/scripts/backup index 5b83cfc..d66fb5b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -54,6 +54,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC BACKUP +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/change_url b/scripts/change_url index 126bdb3..0568b86 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -109,7 +109,7 @@ fi ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Version:" +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Version:" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index 4e44932..d83b7ba 100644 --- a/scripts/install +++ b/scripts/install @@ -153,7 +153,6 @@ chmod -R 764 /home/yunohost.$app #================================================= ynh_script_progression --message="Configuring log rotation..." --weight=1 -# FIXME Currently, the log is only redirected to syslog. mkdir -p /var/log/$app touch /var/log/$app/$app.log chown $app -R /var/log/$app diff --git a/scripts/remove b/scripts/remove index 8891e11..448b919 100644 --- a/scripts/remove +++ b/scripts/remove @@ -76,7 +76,7 @@ ynh_remove_nginx_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 +ynh_script_progression --message="Removing logs and logrotate configuration..." --weight=1 ynh_secure_remove --file="/var/log/$app" diff --git a/scripts/restore b/scripts/restore index 9d2faec..33422df 100644 --- a/scripts/restore +++ b/scripts/restore @@ -103,14 +103,20 @@ systemctl enable $app.service #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "Web-based music collection server and streamer" +yunohost service add $app --description "Web-based music collection server and streamer" --log_path="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Version:" +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Version:" + +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 050fb9e..ec05454 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -146,19 +146,27 @@ chown -R $app:$app $config_path chown -R $app:www-data /home/yunohost.$app/ chmod -R 764 /home/yunohost.$app +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1 + +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "Web-based music collection server and streamer" +yunohost service add $app --description "Web-based music collection server and streamer" --log_path="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Version:" +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Version:" #================================================= # RELOAD NGINX