diff --git a/scripts/install b/scripts/install index 2ef3c9b..9f18050 100644 --- a/scripts/install +++ b/scripts/install @@ -121,20 +121,6 @@ chmod 750 "$data_path" chmod -R o-rwx "$data_path" chown -R $app:www-data "$data_path" -#================================================= -# HANDLE LOG FILES AND LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# Create log directory -mkdir -p /var/log/$app -#touch /var/log/$app/$app.log -logs_path="/var/log/$app" -chown $app -R $logs_path - -# Setup logrotate -ynh_use_logrotate - #================================================= # EDIT MATTERMOST CONFIG #================================================= @@ -176,6 +162,14 @@ pushd "$final_path" ynh_exec_warn_less ynh_exec_as $app bin/mattermost team add "$team_name" "$admin" popd +#================================================= +# 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/restore b/scripts/restore index a5d42d6..4e01f3a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -91,14 +91,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql -#================================================= -# RESTORE USER RIGHTS -#================================================= - -logs_path="/var/log/$app" -mkdir -p $logs_path -chown -R $app: $logs_path - #================================================= # SPECIFIC RESTORATION #================================================= @@ -108,6 +100,13 @@ chown -R $app: $logs_path ynh_restore_file "/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." --time --weight=1 + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #=================================================