backup 823 B

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