backup 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. #=================================================
  3. # GENERIC START
  4. #=================================================
  5. # IMPORT GENERIC HELPERS
  6. #=================================================
  7. source ../settings/scripts/_common.sh
  8. source /usr/share/yunohost/helpers
  9. #=================================================
  10. # MANAGE SCRIPT FAILURE
  11. #=================================================
  12. # Exit if an error occurs during the execution of the script
  13. ynh_abort_if_errors
  14. #=================================================
  15. # LOAD SETTINGS
  16. #=================================================
  17. ynh_print_info --message="Loading installation settings..."
  18. app=$YNH_APP_INSTANCE_NAME
  19. final_path=$(ynh_app_setting_get --app=$app --key=final_path)
  20. #=================================================
  21. # STANDARD BACKUP STEPS
  22. #=================================================
  23. # BACKUP THE APP MAIN DIR
  24. #=================================================
  25. ynh_backup --src_path="$final_path"
  26. #=================================================
  27. # SPECIFIC BACKUP
  28. #=================================================
  29. # BACKUP LOGROTATE
  30. #=================================================
  31. ynh_backup --src_path="/etc/logrotate.d/$app"
  32. #=================================================
  33. # BACKUP THE CRON FILE
  34. #=================================================
  35. ynh_backup --src_path="/etc/cron.d/$app"
  36. #=================================================
  37. # END OF SCRIPT
  38. #=================================================
  39. ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."