restore 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 $backup_dir/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 < $backup_dir/$app.dmp
  18. # Restore Nginx and YunoHost parameters
  19. sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app
  20. domain=$(sudo yunohost app setting $app domain)
  21. sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
  22. # If a dedicated php-fpm process is used :
  23. # Copy dedicated php-fpm process from backup folder to the right location
  24. # And restart service
  25. #
  26. #sudo cp -a $backup_dir/php-fpm.conf /etc/php5/fpm/pool.d/$app.conf
  27. #sudo service php5-fpm reload
  28. # Restart webserver
  29. sudo service nginx reload