2
0

backup 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. # Exit if an error occurs during the execution of the script
  14. ynh_abort_if_errors
  15. #=================================================
  16. # LOAD SETTINGS
  17. #=================================================
  18. ynh_print_info --message="Loading installation settings..."
  19. app=$YNH_APP_INSTANCE_NAME
  20. final_path=$(ynh_app_setting_get --app=$app --key=final_path)
  21. #=================================================
  22. # DECLARE DATA AND CONF FILES TO BACKUP
  23. #=================================================
  24. ynh_print_info --message="Declaring files to be backed up..."
  25. #=================================================
  26. # BACKUP THE APP MAIN DIR
  27. #=================================================
  28. ynh_backup --src_path="$final_path"
  29. #=================================================
  30. # SPECIFIC BACKUP
  31. #=================================================
  32. # BACKUP LOGROTATE
  33. #=================================================
  34. ynh_backup --src_path="/etc/logrotate.d/$app"
  35. #=================================================
  36. # BACKUP VARIOUS FILES
  37. #=================================================
  38. ynh_backup --src_path="/etc/cron.d/$app"
  39. #=================================================
  40. # END OF SCRIPT
  41. #=================================================
  42. ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."