restore 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. # causes the shell to exit if any subcommand or pipeline returns a non-zero status
  3. set -e
  4. app=ynhexample
  5. # The parameter $1 is the uncompressed restore directory location
  6. backup_dir=$1/apps/$app
  7. # Restore sources & data
  8. sudo cp -a $backup_dir/sources/. /var/www/$app
  9. # Restore permissions to app files
  10. # you may need to make some file and/or directory writeable by www-data (nginx user)
  11. sudo chown -R root:root $final_path
  12. # Restore mysql database if needed
  13. # db_pwd=$(sudo yunohost app setting $app mysqlpwd)
  14. # sudo mysql -u $app -p$db_pwd $app < $backup_dir/$app.dmp
  15. # Restore Nginx and YunoHost parameters
  16. sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app
  17. domain=$(sudo yunohost app setting $app domain)
  18. sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
  19. # If a dedicated php-fpm process is used :
  20. # Copy dedicated php-fpm process from backup folder to the right location
  21. # And restart service
  22. #
  23. #sudo cp -a $backup_dir/php-fpm.conf /etc/php5/fpm/pool.d/$app.conf
  24. #sudo service php5-fpm reload
  25. # Restart webserver
  26. sudo service nginx reload