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
2024-09-01 23:44:30 +02:00

55 lines
1.8 KiB
Bash
Executable file

#!/bin/bash
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
load_vars
ynh_script_progression "Configuring databases access..."
configure_db
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression "Restoring files"
ynh_restore_everything
mkdir -p /var/log/"$app"
systemctl enable "$app".service --quiet
ynh_script_progression "Configuring php fpm access if needed..."
if "$phpfpm_installed"; then
config_php_fpm
fi
yunohost service add "$app" --description="Monitorix" --log="systemd"
#=================================================
# RESTORE THE DEPENDENCIES
#=================================================
ynh_script_progression "Restoring the dependencies..."
install_monitorix_package
ynh_systemctl --service="$app" --action=stop --log_path=systemd --timeout=15
#=================================================
ynh_script_progression "Protecting directory..."
set_permission
ynh_config_add_logrotate "/var/log/$app"
#=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression "Reloading NGINX web server and $app's service..."
ynh_systemctl --service="$app" --action=start --log_path='systemd' --wait_until=' - Ok, ready.'
# 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_systemctl --service=nginx.service --action=restart
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Restoration completed for $app"