1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lufi_ynh.git synced 2024-09-03 19:36:28 +02:00
lufi_ynh/scripts/restore

64 lines
2.3 KiB
Text
Raw Normal View History

2017-04-01 18:16:18 +02:00
#!/bin/bash
2019-03-03 18:04:55 +01:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-04-01 18:16:18 +02:00
2022-01-27 02:40:24 +01:00
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
2019-03-03 18:04:55 +01:00
source ../settings/scripts/_common.sh
2017-04-01 18:16:18 +02:00
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2022-06-16 19:19:38 +02:00
2019-03-03 18:04:55 +01:00
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
2020-05-30 16:34:01 +02:00
ynh_script_progression --message="Restoring the PostregSQL database..."
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
2022-01-27 02:40:24 +01:00
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
2022-01-27 02:40:24 +01:00
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
2022-01-27 02:40:24 +01:00
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2022-01-27 02:40:24 +01:00
ynh_restore_file --origin_path="/etc/cron.d/$app"
2019-03-03 18:04:55 +01:00
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
2020-12-13 21:16:52 +01:00
systemctl enable $app.service --quiet
2019-03-03 18:04:55 +01:00
2022-01-27 02:40:24 +01:00
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
yunohost service add $app --description="Lufi service" --log="$install_dir/log/production.log"
2019-03-03 18:04:55 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
2019-03-03 18:04:55 +01:00
#=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="$install_dir/log/production.log" --line_match="Creating process id file"
2019-03-03 18:04:55 +01:00
ynh_systemd_action --service_name=nginx --action=reload
2019-03-03 18:04:55 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2020-05-30 16:34:01 +02:00
ynh_script_progression --message="Restoration completed for $app"