backup 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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="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_script_progression --message="Backing up the main app directory..."
  26. ynh_backup --src_path="$final_path"
  27. #=================================================
  28. # SPECIFIC BACKUP
  29. #=================================================
  30. # BACKUP LOGROTATE
  31. #=================================================
  32. ynh_script_progression --message="Backing up logrotate configuration..."
  33. ynh_backup --src_path="/etc/logrotate.d/$app"
  34. #=================================================
  35. # BACKUP THE CRON FILE
  36. #=================================================
  37. ynh_backup --src_path="/etc/cron.d/$app"
  38. #=================================================
  39. # END OF SCRIPT
  40. #=================================================
  41. ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last