1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monitorix_ynh.git synced 2024-09-03 19:46:06 +02:00
monitorix_ynh/scripts/restore

71 lines
2.5 KiB
Text
Raw Normal View History

2017-01-05 23:37:07 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
2023-12-09 00:35:51 +01:00
# IMPORT GENERIC HELPERS
#=================================================
2023-12-09 00:35:51 +01:00
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
2020-11-17 23:37:38 +01:00
source ../settings/scripts/_common.sh
source ../settings/scripts/experimental_helper.sh
2017-07-21 22:11:45 +02:00
source /usr/share/yunohost/helpers
load_vars
2017-01-05 23:37:07 +01:00
#=================================================
2023-12-09 00:35:51 +01:00
# RESTORE THE DEPENDENCIES
#=================================================
2023-12-09 00:35:51 +01:00
ynh_script_progression --message="Restoring the dependencies..." --weight=1
2023-12-09 00:35:51 +01:00
install_monitorix_package
ynh_systemd_action --service_name="$app" --action=stop --log_path=systemd --timeout=15
mkdir -p /var/log/new_"${app}"
mv -t /var/log/new_"${app}" /var/log/monitorix*
mv /var/log/new_"${app}" /var/log/"${app}"
2023-12-09 00:35:51 +01:00
ynh_script_progression --message="Configuring databases access..."
configure_db
2023-12-09 00:35:51 +01:00
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring files" --weight=1
2017-10-31 23:08:23 +01:00
ynh_restore
mkdir -p /var/log/$app
2023-12-09 00:35:51 +01:00
systemctl enable $app.service --quiet
2017-01-05 23:37:07 +01:00
ynh_script_progression --message="Configuring php fpm access if needed..."
if "$phpfpm_installed"; then
config_php_fpm
fi
2023-12-09 00:35:51 +01:00
yunohost service add $app --description="Monitorix" --log="systemd"
2023-01-22 03:09:34 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_script_progression --message="Protecting directory..."
2023-12-09 00:35:51 +01:00
set_permission
ynh_use_logrotate --logfile "/var/log/$app"
2023-12-09 00:35:51 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name="$app" --action=start --log_path 'systemd' --line_match ' - Ok, ready.'
2024-04-04 22:42:20 +02:00
# when we change the value of 'listen [::1]:xxx;' nginx don't reload correctly the config, so force to restart to ensure that the new config are loaded
ynh_systemd_action --service_name=nginx.service --action=restart
2023-12-09 00:35:51 +01:00
ynh_systemd_action --service_name=nginx --action=reload
2017-08-16 14:46:25 +02:00
2023-12-09 00:35:51 +01:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last