Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.09 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Author: KR
  4. # Created: 25th June 2019
  5.  
  6.  
  7. echo -e 'This will set up the websockets server as a permanent service.\n'
  8.  
  9. if [[ $# -lt 1 ]]; then
  10.     read -p 'Supply the full path to your project: ' project
  11. else
  12.     project=$1
  13. fi
  14.  
  15. echo -e '\n...installing supervisor (and sed)\n'
  16. sudo apt-get install --assume-yes sed >> /dev/null
  17. sudo apt-get install --assume-yes supervisor >> /dev/null
  18.  
  19. config="/etc/supervisor/conf.d/onzite-websockets.conf"
  20. echo -e "\n...adding the websockets config to $config \n"
  21.  
  22. echo -e "[program:onzite-websockets]\n
  23. command=/usr/bin/php $project/artisan websockets:serve \n
  24. numprocs=1\n
  25. autostart=true\n
  26. autorestart=true\n
  27. user=www-data" | sudo tee ${config} >> /dev/null
  28.  
  29. config='/etc/supervisor/supervisord.conf'
  30. echo -e "\n...updating max concurrent files in $config \n"
  31. sudo sed '/^\[supervisord\]$/a minfds=10240; (min. avail startup file descriptors;default 1024)' ${config} > /dev/null
  32.  
  33. echo -e '\n...enabling supervisor \n'
  34. sudo systemctl restart supervisor
  35. sudo systemctl enable supervisor
  36.  
  37. echo -e '\n\n...Websockets setup complete'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement