restore 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. #=================================================
  3. # IMPORT GENERIC HELPERS
  4. #=================================================
  5. # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
  6. source ../settings/scripts/_common.sh
  7. source /usr/share/yunohost/helpers
  8. #=================================================
  9. # RESTORE THE APP MAIN DIR
  10. #=================================================
  11. ynh_script_progression "Restoring the app main directory..."
  12. ynh_restore "$install_dir"
  13. chown -R "$app:www-data" "$install_dir"
  14. #=================================================
  15. # RESTORE THE DATA DIRECTORY
  16. #=================================================
  17. ynh_script_progression "Restoring the data directory..."
  18. ynh_restore "$data_dir"
  19. chown -R "$app:www-data" "$data_dir"
  20. #=================================================
  21. # RESTORE SYSTEM CONFIGURATION
  22. #=================================================
  23. ynh_script_progression "Restoring system configurations related to $app..."
  24. ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
  25. ynh_restore "/etc/logrotate.d/$app"
  26. #ynh_restore "/etc/fail2ban/jail.d/$app.conf"
  27. #ynh_restore "/etc/fail2ban/filter.d/$app.conf"
  28. #ynh_systemctl --action=restart --service=fail2ban
  29. #=================================================
  30. # RESTORE VARIOUS FILES
  31. #=================================================
  32. ynh_restore "/var/log/$app/"
  33. #=================================================
  34. # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
  35. #=================================================
  36. ynh_script_progression "Reloading NGINX web server and $app's service..."
  37. ynh_systemctl --service=nginx --action=reload
  38. #=================================================
  39. # END OF SCRIPT
  40. #=================================================
  41. ynh_script_progression "Restoration completed for $app"