backup 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. #=================================================
  3. # GENERIC START
  4. #=================================================
  5. # IMPORT GENERIC HELPERS
  6. #=================================================
  7. if [ ! -e _common.sh ]; then
  8. # Get the _common.sh file if it's not in the current directory
  9. cp ../settings/scripts/_common.sh ./_common.sh
  10. chmod a+rx _common.sh
  11. fi
  12. source _common.sh
  13. source /usr/share/yunohost/helpers
  14. #=================================================
  15. # MANAGE SCRIPT FAILURE
  16. #=================================================
  17. # Exit if an error occurs during the execution of the script
  18. ynh_abort_if_errors
  19. #=================================================
  20. # LOAD SETTINGS
  21. #=================================================
  22. app=$YNH_APP_INSTANCE_NAME
  23. final_path=$(ynh_app_setting_get $app final_path)
  24. #=================================================
  25. # STANDARD BACKUP STEPS
  26. #=================================================
  27. # BACKUP THE APP MAIN DIR
  28. #=================================================
  29. ynh_backup "$final_path"
  30. #=================================================
  31. # SPECIFIC BACKUP
  32. #=================================================
  33. # BACKUP LOGROTATE
  34. #=================================================
  35. ynh_backup "/etc/logrotate.d/$app"
  36. #=================================================
  37. # BACKUP THE CRON FILE
  38. #=================================================
  39. ynh_backup "/etc/cron.d/$app"