restore 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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 of the app
  6. # from where the script is executed
  7. backup_dir=$YNH_APP_BACKUP_DIR
  8. # Restore sources & data
  9. final_path="/var/www/${app}"
  10. sudo cp -a ./sources "$final_path"
  11. # Restore permissions to app files
  12. # you may need to make some file and/or directory writeable by www-data (nginx user)
  13. sudo chown -R root:root "$final_path"
  14. # Restore mysql database if needed
  15. # db_pwd=$(sudo yunohost app setting $app mysqlpwd)
  16. # sudo mysql -u $app -p$db_pwd $app < ./dump.sql
  17. # Restore NGINX configuration
  18. domain=$(sudo yunohost app setting "$app" domain)
  19. sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
  20. # If a dedicated php-fpm process is used :
  21. # Copy dedicated php-fpm process from backup folder to the right location
  22. # And restart service
  23. #
  24. #sudo cp -a ./php-fpm.conf "/etc/php5/fpm/pool.d/${app}.conf"
  25. #sudo service php5-fpm reload
  26. # Restart webserver
  27. sudo service nginx reload