I am currently developing a chat program where the Server as Ubuntu + Swift and client as JavaScript + WebSocket. Finally I reached the 0.1 version and I need to deploy it for public use.

I am renting a Virtual Cloud Server with Ubuntu 16.04 LST and I installed Swift 3 and my developed chat server as collection of .swift files. I can compile and run my chat server using swift commands. But as soon as I close my SSH connection the server stops. Yea, I can understand why.

  1. How can I start my chat server permanently on my Virtual Cloud Server?
  2. Do I really need to make it as a service e.g. service squid start then how?

Where to start? I searched a lot in internet but could not find any example or advice. Any help? Thank you in advance.

  • You say you understand why but apparently you don't since you would otherwise know it's caused by the SIGHUP sent by the shell to its child processes when it closes and that it can be easily overcome by making a proper service, which would take 5 minutes. If your program is really not worth that 5 minute effort, you could run it with nohup. – Julie Pelletier Jan 10 '17 at 15:14
  • In addition to nohup bash has also disown that affects a backgrounded job. Or write a service unit if you intend to run it independently. – phg Jan 10 '17 at 16:11
  • Thank you both @JuliePelletier and it is something. Can you please give me more help on writing my own service. I am sorry I am not that deep in linux or unix. – Goppinath Jan 10 '17 at 16:17

Browse other questions tagged or ask your own question.