2
0

backup 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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_script_progression --message="Load settings"
  18. app=$YNH_APP_INSTANCE_NAME
  19. final_path=$(ynh_app_setting_get $app final_path)
  20. #=================================================
  21. # STANDARD BACKUP STEPS
  22. #=================================================
  23. # BACKUP THE APP MAIN DIR
  24. #=================================================
  25. ynh_script_progression --message="Backup the app main dir"
  26. ynh_backup "$final_path"
  27. #=================================================
  28. # SPECIFIC BACKUP
  29. #=================================================
  30. # BACKUP LOGROTATE
  31. #=================================================
  32. ynh_script_progression --message="Backup logrotate configuration"
  33. ynh_backup "/etc/logrotate.d/$app"
  34. #=================================================
  35. # BACKUP THE CRON FILE
  36. #=================================================
  37. ynh_script_progression --message="Backup cron file"
  38. ynh_backup "/etc/cron.d/$app"
  39. #=================================================
  40. # END OF SCRIPT
  41. #=================================================
  42. ynh_script_progression --message="Backup completed" --last