I have both a ruby script and a qt executable. Both of them pretty much accomplish same task but listen on different ports. Basically, they are UDP socket servers listening for incoming connections on a specified port on my remote ubuntu server. They listen for UDP packets coming in from GSM modems of GPS devices. Now right now I can ssh into my remote server and run the ruby script to begin listening for connections to said port: "ruby server.rb". But as soon as I log out and close the ssh connection, the script presumably stops listening. I want this script to continue listening for incoming connections on that port forever, even after I log out of server.
sudo netstat -tulpn tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 25391/mysqld
That mysqld server listens constantly for incoming connections to port 3306. I want my script to do the same thing. I want to be able to run netstat and always see my program running and listening on a specified port.
What is the best approach to take in this situation? Create a daemon? Or use nohup?