backup 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. ynh_abort_if_errors # Stop script if an error is detected
  18. #=================================================
  19. # LOAD SETTINGS
  20. #=================================================
  21. app=$YNH_APP_INSTANCE_NAME
  22. final_path=$(ynh_app_setting_get $app final_path)
  23. domain=$(ynh_app_setting_get $app domain)
  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. #=================================================
  39. # SPECIFIC BACKUP
  40. #=================================================
  41. # BACKUP SYSTEMD
  42. #=================================================
  43. ynh_backup "/etc/systemd/system/ynh-$app.service" # XXX maybe hard-coding the full name would be better
  44. ynh_backup "/etc/systemd/system/ynh-$app-checker.service" # XXX maybe hard-coding the full name would be better
  45. ynh_backup "/etc/systemd/system/ynh-$app-checker.timer" # XXX maybe hard-coding the full name would be better
  46. exit 0