0

I've followed this tutorial on setting up a websocket to live update my website, which I've followed and it works fine, however, I need to keep a putty terminal open connected to my CentOS server for the command php bin/server.php. How can I leave that command running constantly? Could I set it up as a service, or would I different approach be better?

EDIT: I've found using (from bin folder) php server.php & will run the script in the background, so I can do other things via ssh, but if I close the connection it stops running.

TMH
  • 6,096
  • 7
  • 51
  • 88

1 Answers1

0

I found this nohup php server.php > /dev/null & here which seems to do the trick :)

I also got a bit stuck stopping the script... I used ps to get php's process ID and then killed using kill [id]

Community
  • 1
  • 1
TMH
  • 6,096
  • 7
  • 51
  • 88