backup 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. domain=$(ynh_app_setting_get $app domain)
  25. db_name=$(ynh_app_setting_get $app db_name)
  26. #=================================================
  27. # STANDARD BACKUP STEPS
  28. #=================================================
  29. # BACKUP THE APP MAIN DIR
  30. #=================================================
  31. # LOAD SETTINGS
  32. #=================================================
  33. app=$YNH_APP_INSTANCE_NAME
  34. final_path=$(ynh_app_setting_get $app final_path)
  35. domain=$(ynh_app_setting_get $app domain)
  36. #=================================================
  37. # STANDARD BACKUP STEPS
  38. #=================================================
  39. # BACKUP THE APP MAIN DIR
  40. #=================================================
  41. ynh_backup "$final_path"
  42. #=================================================
  43. # BACKUP THE NGINX CONFIGURATION
  44. #=================================================
  45. ynh_backup "/etc/nginx/conf.d/$domain.d/${app}.conf"
  46. #=================================================
  47. # BACKUP THE PHP-FPM CONFIGURATION
  48. #=================================================
  49. ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
  50. #=================================================
  51. # SPECIFIC BACKUP
  52. #=================================================
  53. # BACKUP SYSTEMD
  54. #=================================================
  55. ynh_backup "/etc/systemd/system/ynh-vpnclient.service"
  56. ynh_backup "/etc/systemd/system/ynh-vpnclient-checker.service"
  57. ynh_backup "/etc/systemd/system/ynh-vpnclient-checker.timer"
  58. ynh_backup "/etc/cron.d/$app"