restore 1.1 KB

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