2016-03-18 18:38:54 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
2022-01-15 10:05:56 +01:00
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2016-03-18 18:38:54 +01:00
|
|
|
|
2022-01-15 10:05:56 +01:00
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
2020-11-17 23:55:57 +01:00
|
|
|
source ../settings/scripts/_common.sh
|
2018-08-14 22:18:22 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
2016-03-18 18:38:54 +01:00
|
|
|
|
2022-01-15 10:05:56 +01:00
|
|
|
#=================================================
|
2018-08-14 22:18:22 +02:00
|
|
|
# RESTORE THE MYSQL DATABASE
|
2022-01-15 10:05:56 +01:00
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
|
|
|
|
2024-01-30 23:33:35 +01:00
|
|
|
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
|
2018-08-14 22:18:22 +02:00
|
|
|
|
2022-01-15 13:19:43 +01:00
|
|
|
#=================================================
|
|
|
|
# RESTORE VARIOUS FILES
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoring various files..." --weight=1
|
2024-02-23 00:21:58 +01:00
|
|
|
ynh_restore
|
2018-08-14 22:18:22 +02:00
|
|
|
|
2022-01-15 13:19:43 +01:00
|
|
|
#=================================================
|
2024-01-30 23:33:35 +01:00
|
|
|
# RESTORE SYSTEM CONFIGURATIONS
|
2022-01-15 13:19:43 +01:00
|
|
|
#=================================================
|
2024-01-30 23:33:35 +01:00
|
|
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
2022-01-15 13:19:43 +01:00
|
|
|
|
2024-01-31 10:33:23 +01:00
|
|
|
yunohost service add "sogo" --description="Groupware for E-Mail, Contacts and Calender" --log="/var/log/$app/$app.log"
|
2024-02-23 00:21:58 +01:00
|
|
|
set_permissions
|
2022-01-15 10:05:56 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=3
|
|
|
|
|
2024-01-30 23:33:35 +01:00
|
|
|
ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd"
|
2022-01-15 10:05:56 +01:00
|
|
|
|
|
|
|
#=================================================
|
2024-02-23 00:21:58 +01:00
|
|
|
# RELOAD NGINX
|
2022-01-15 10:05:56 +01:00
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
|
|
|
2024-01-30 23:33:35 +01:00
|
|
|
ynh_systemd_action --service_name="nginx" --action=reload
|
2022-01-15 10:05:56 +01:00
|
|
|
|
2024-02-23 00:21:58 +01:00
|
|
|
# Use logrotate to manage app-specific logfile(s)
|
|
|
|
ynh_use_logrotate --logfile="/var/log/$app/sogo.log" --nonappend
|
|
|
|
|
2022-01-15 10:05:56 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2020-05-24 00:32:03 +02:00
|
|
|
|
2019-06-07 23:09:30 +02:00
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|