#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_restore_file --origin_path="$install_dir" #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/scrutiny-web-server.service" systemctl enable "/etc/systemd/system/scrutiny-web-server.service" --quiet ynh_restore_file --origin_path="/etc/systemd/system/scrutiny-collector.service" ynh_restore_file --origin_path="/etc/systemd/system/scrutiny-collector.timer" yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A.R.T monitoring" --log="/var/log/$app/$app-web-server.log" if [ $collector ]; then yunohost service add "scrutiny-collector.timer" --description="Collector timer for smartd S.M.A.R.T monitoring" --log="/var/log/$app/$app-web-server.log" fi ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/var/log/$app" #================================================= # 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 # Typically you only have either $app or php-fpm but not both at the same time... ynh_systemd_action --service_name="influxdb" --action="start" ynh_systemd_action --service_name="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/scrutiny-web-server.log" if [ $collector ]; then systemctl daemon-reload ynh_systemd_action --service_name="scrutiny-collector.service" --action="enable" ynh_systemd_action --service_name="scrutiny-collector.service" --action="start" --log_path="/var/log/$app/scrutiny-collector.log" ynh_systemd_action --service_name="scrutiny-collector.timer" --action="enable" ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" fi ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Restoration completed for $app" --last