72 lines
2.2 KiB
Bash
72 lines
2.2 KiB
Bash
#!/bin/bash
|
|||
|
|
|
||
|
|
#=================================================
|
||
|
|
# IMPORT GENERIC HELPERS
|
||
|
|
#=================================================
|
||
|
|
|
||
|
|
source _common.sh
|
||
|
|
source /usr/share/yunohost/helpers
|
||
|
|
|
||
|
|
#=================================================
|
||
|
|
# RESTORE THE APP MAIN DIR
|
||
|
|
#=================================================
|
||
|
|
ynh_script_progression "Restauration des fichiers de $app…"
|
||
|
|
|
||
|
|
ynh_restore "$install_dir"
|
||
|
|
|
||
|
|
chown -R "$app:$app" "$install_dir"
|
||
|
|
|
||
|
|
#=================================================
|
||
|
|
# RESTORE THE DATA DIR
|
||
|
|
#=================================================
|
||
|
|
ynh_script_progression "Restauration de la base de veille…"
|
||
|
|
|
||
|
|
ynh_restore "$data_dir/veille.db"
|
||
|
|
ynh_restore "$data_dir/textes.json"
|
||
|
|
|
||
|
|
mkdir -p "$data_dir/cache_http"
|
||
|
|
chown -R "$app:$app" "$data_dir"
|
||
|
|
|
||
|
|
# Le schéma peut avoir évolué entre la sauvegarde et la restauration : les
|
||
|
|
# migrations sont rejouées, elles sont idempotentes.
|
||
|
|
migrer_la_base
|
||
|
|
|
||
|
|
#=================================================
|
||
|
|
# RESTORE SYSTEM CONFIGURATION
|
||
|
|
#=================================================
|
||
|
|
ynh_script_progression "Restauration de la configuration système…"
|
||
|
|
|
||
|
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||
|
|
|
||
|
|
ynh_restore "/etc/systemd/system/$app.service"
|
||
|
|
systemctl enable "$app.service" --quiet
|
||
|
|
|
||
|
|
ynh_restore "/etc/systemd/system/$app-pipeline.service"
|
||
|
|
ynh_restore "/etc/systemd/system/$app-pipeline.timer"
|
||
|
|
systemctl daemon-reload
|
||
|
|
systemctl enable "$app-pipeline.timer" --quiet
|
||
|
|
systemctl start "$app-pipeline.timer"
|
||
|
|
|
||
|
|
yunohost service add "$app" --description="$DESCRIPTION_SERVICE" \
|
||
|
|
--log="/var/log/$app/$app.log"
|
||
|
|
|
||
|
|
mkdir -p "/var/log/$app"
|
||
|
|
chown -R "$app:$app" "/var/log/$app"
|
||
|
|
ynh_restore "/etc/logrotate.d/$app"
|
||
|
|
|
||
|
|
#=================================================
|
||
|
|
# RELOAD NGINX AND START THE APP SERVICE
|
||
|
|
#=================================================
|
||
|
|
ynh_script_progression "Rechargement de NGINX et démarrage de $app…"
|
||
|
|
|
||
|
|
ynh_systemctl --service="$app" --action="start" --wait_until="Listening" \
|
||
|
|
--log_path="/var/log/$app/$app.log"
|
||
|
|
|
||
|
|
ynh_systemctl --service=nginx --action=reload
|
||
|
|
|
||
|
|
#=================================================
|
||
|
|
# END OF SCRIPT
|
||
|
|
#=================================================
|
||
|
|
|
||
|
|
ynh_script_progression "Restauration de $app terminée"
|