backup 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. domain=$(ynh_app_setting_get "$app" domain)
  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_backup "$final_path"
  26. #=================================================
  27. # BACKUP THE NGINX CONFIGURATION
  28. #=================================================
  29. ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
  30. #=================================================
  31. # BACKUP THE PHP-FPM CONFIGURATION
  32. #=================================================
  33. ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
  34. ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
  35. #=================================================
  36. # BACKUP THE MYSQL DATABASE
  37. #=================================================
  38. ynh_mysql_dump_db "$db_name" > db.sql