backup 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. #=================================================
  3. # GENERIC START
  4. #=================================================
  5. # IMPORT GENERIC HELPERS
  6. #=================================================
  7. # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
  8. source ../settings/scripts/_common.sh
  9. source /usr/share/yunohost/helpers
  10. #=================================================
  11. # MANAGE SCRIPT FAILURE
  12. #=================================================
  13. #REMOVEME? ynh_clean_setup () {
  14. ### Remove this function if there's nothing to clean before calling the remove script.
  15. true
  16. }
  17. # Exit if an error occurs during the execution of the script
  18. #REMOVEME? ynh_abort_if_errors
  19. #=================================================
  20. # LOAD SETTINGS
  21. #=================================================
  22. #REMOVEME? ynh_print_info --message="Loading installation settings..."
  23. #REMOVEME? app=$YNH_APP_INSTANCE_NAME
  24. #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
  25. #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
  26. #=================================================
  27. # DECLARE DATA AND CONF FILES TO BACKUP
  28. #=================================================
  29. ynh_print_info --message="Declaring files to be backed up..."
  30. #=================================================
  31. # BACKUP THE APP MAIN DIR
  32. #=================================================
  33. ynh_backup --src_path="$install_dir"
  34. #=================================================
  35. # BACKUP THE NGINX CONFIGURATION
  36. #=================================================
  37. ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
  38. #=================================================
  39. # BACKUP SYSTEMD
  40. #=================================================
  41. ynh_backup --src_path="/etc/systemd/system/$app.service"
  42. #=================================================
  43. # END OF SCRIPT
  44. #=================================================
  45. ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."