backup 744 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. # Exit on command errors and treat unset variables as an error
  3. set -eu
  4. # Get multi-instances specific variables
  5. app=$YNH_APP_INSTANCE_NAME
  6. # Source app helpers
  7. source /usr/share/yunohost/helpers
  8. # Retrieve app settings
  9. domain=$(ynh_app_setting_get "$app" domain)
  10. # Copy the app files
  11. final_path="/var/www/${app}"
  12. ynh_backup "$final_path" "sources" 1
  13. # Copy the nginx conf files
  14. ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
  15. # Copy the php-fpm conf files
  16. ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
  17. ynh_backup "/etc/php5/fpm/conf.d/20-${app}.ini" "php-fpm.ini"
  18. # Backup db
  19. root_pwd=$(sudo cat /etc/yunohost/mysql)
  20. sudo su -c "mysqldump -u root -p$root_pwd --no-create-db $app > ./db.sql"