backup 939 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. # Exit on command errors and treat unset variables as an error
  3. set -eu
  4. # See comments in install script
  5. app=$YNH_APP_INSTANCE_NAME
  6. # Source YunoHost helpers
  7. source /usr/share/yunohost/helpers
  8. # Backup sources & data
  9. # Note: the last argument is where to save this path, see the restore script.
  10. ynh_backup "/var/www/${app}" "sources"
  11. ### MySQL (remove if not used) ###
  12. # If a MySQL database is used:
  13. # # Dump the database
  14. # dbname=$app
  15. # dbuser=$app
  16. # dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
  17. # mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
  18. ### MySQL end ###
  19. # Copy NGINX configuration
  20. domain=$(ynh_app_setting_get "$app" domain)
  21. ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
  22. ### PHP (remove if not used) ###
  23. # If a dedicated php-fpm process is used:
  24. # # Copy PHP-FPM pool configuration
  25. # ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
  26. ### PHP end ###