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. 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=$1
  8. # Restore sources & data
  9. final_path=/var/www/$app
  10. sudo cp -a $backup_dir/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 < $backup_dir/$app.dmp
  17. # Restore Nginx and YunoHost parameters
  18. sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app
  19. domain=$(sudo yunohost app setting $app domain)
  20. sudo cp -a $backup_dir/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 $backup_dir/php-fpm.conf /etc/php5/fpm/pool.d/$app.conf
  26. #sudo service php5-fpm reload
  27. # Restart webserver
  28. sudo service nginx reload