backup 812 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. # causes the shell to exit if any subcommand or pipeline returns a non-zero status
  3. set -e
  4. app=$YNH_APP_INSTANCE_NAME
  5. # The first argument is the backup directory location for the app
  6. # from where the script is executed and which will be compressed afterward
  7. backup_dir=$YNH_APP_BACKUP_DIR
  8. # Backup sources & data
  9. sudo cp -a "/var/www/${app}" ./sources
  10. # Backup mysql database if needed
  11. # db_pwd=$(sudo yunohost app setting $app mysqlpwd)
  12. # sudo mysqldump -u $app -p$db_pwd $app > ./dump.sql
  13. # Copy NGINX configuration
  14. domain=$(sudo yunohost app setting "$app" domain)
  15. sudo cp -a "/etc/nginx/conf.d/${domain}.d/${app}.conf" ./nginx.conf
  16. # If a dedicated php-fpm process is used :
  17. # Copy dedicated php-fpm process to backup folder
  18. #
  19. #sudo cp -a "/etc/php5/fpm/pool.d/${app}.conf" ./php-fpm.conf