1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cockpit_ynh.git synced 2024-09-03 18:16:26 +02:00
cockpit_ynh/scripts/restore

47 lines
1.7 KiB
Bash

#!/bin/bash
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression "Fixing up permissions..."
usermod -a -G cockpit cockpit-ws
usermod -a -G cockpit cockpit-wsinstance
ynh_script_progression "Restoring various files..."
ynh_replace --match="ListenStream=.*" --replace="ListenStream=$port" --file="/lib/systemd/system/cockpit.socket"
systemctl daemon-reload
systemctl restart $app.socket
ynh_restore "/etc/cockpit/cockpit.conf"
#=================================================
# 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"
yunohost service add $app --description="Sysadmin login session in a web browser" --log="/var/log/$app/$app.log"
#=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression "Reloading NGINX web server and $app's service..."
ynh_systemctl --service=$app --action="restart" --log_path="systemd" --wait_until="Started"
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Restoration completed for $app"