Advertisement
Guest User

Untitled

a guest
Mar 26th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. first_run=${first_run:-false}
  4. host=${host:-domain.com}
  5. conf=${conf:-'static_sites.conf'}
  6. ssh_cmd=${ssh_cmd:-'ssh}'
  7. curr_user=${curr_user:-'dokku'}
  8. new_user=${new_user:-'static'}
  9.  
  10. if [ ! -z "$new_pass" ]; then
  11. new_pass=":$new_pass"
  12. fi
  13.  
  14. function first_run_f () {
  15. # eval "$ssh_cmd $curr_user@$host \"sudo adduser $new_user\""
  16. eval "$ssh_cmd $curr_user@$host 'sudo touch /etc/nginx/conf.d/static_sites.conf && sudo chown static:static /etc/nginx/conf.d/static_sites.conf'"
  17. rsync -e "$ssh_cmd" -azP "$conf" "${new_user}${new_pass}@${host}":/etc/nginx/conf.d/static_sites.conf
  18. eval "$ssh_cmd $host sudo service nginx restart"
  19. }
  20.  
  21. if $first_run; then
  22. first_run_f
  23. fi
  24.  
  25. rsync -e "$ssh_cmd" -azP web-frontend "${new_user}${new_pass}@${host}":/tmp
  26. #/home/static/sites/web-frontend
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement