#!/bin/bash source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= ynh_script_progression "Restoring system configurations related to $app..." ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore "/etc/systemd/system/scrutiny-web-server.service" ynh_restore "/etc/systemd/system/scrutiny-collector.service" ynh_restore "/etc/systemd/system/scrutiny-collector.timer" ynh_restore "/etc/logrotate.d/$app" ynh_restore "/var/log/$app" #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= ynh_script_progression "Reloading NGINX web server and $app's service..." systemctl daemon-reload ynh_systemctl --service="nginx" --action="reload" ynh_systemctl --service="influxdb" --action="enable" ynh_systemctl --service="influxdb" --action="start" systemctl enable "/etc/systemd/system/scrutiny-web-server.service" --quiet yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A.R.T monitoring" --log="/var/log/$app/web-server.log" --test_status="systemctl show scrutiny-web-server.service -p ActiveState --value | grep -v failed" ynh_systemctl --service="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log" if [ $collector -eq 1 ] then yunohost service add "scrutiny-collector" --description="Collector running on timer (daily) for smartd S.M.A.R.T monitoring" --log="/var/log/$app/collector.log" --test_status="systemctl show scrutiny-collector.service -p ActiveState --value | grep -v failed" ynh_systemctl --service="scrutiny-collector.timer" --action="enable" ynh_systemctl --service="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log" fi #================================================= # END OF SCRIPT #================================================= ynh_script_progression "Restoration completed for $app"