backup 921 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. 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=$1
  8. # Backup sources & data
  9. sudo cp -a /var/www/$app/. $backup_dir/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 > $backup_dir/$app.dmp
  13. # Copy Nginx and YunoHost parameters to make the script "standalone"
  14. sudo cp -a /etc/yunohost/apps/$app/. $backup_dir/yunohost
  15. domain=$(sudo yunohost app setting $app domain)
  16. sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf $backup_dir/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 $backup_dir/php-fpm.conf