backup 1.6 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. ynh_clean_setup () {
  13. ### Remove this function if there's nothing to clean before calling the remove script.
  14. true
  15. }
  16. # Exit if an error occurs during the execution of the script
  17. ynh_abort_if_errors
  18. #=================================================
  19. # LOAD SETTINGS
  20. #=================================================
  21. domain=$(ynh_app_setting_get "$app" domain)
  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. # BACKUP THE NGINX CONFIGURATION
  32. #=================================================
  33. ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
  34. #=================================================
  35. # BACKUP THE PHP-FPM CONFIGURATION
  36. #=================================================
  37. ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
  38. ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
  39. #=================================================
  40. # BACKUP THE MYSQL DATABASE
  41. #=================================================
  42. ynh_mysql_dump_db "$db_name" > db.sql