PDA

View Full Version : Running a server in background



aragon
07-19-2010, 06:21 AM
Hello,

I have to develop a client/server application.

I would like to know if it is possible to make the server run on host395.hostmonster.com, using for example sockets (bind(), listen(), etc).
The server will listen to a specific port and accept clients.

A solution would be to develop the server in PHP and then run it in background with a command like exec("php -f ./myserver.php").
Another solution would be to compile a program written in C, and execute it in background using the command system("./myserver &") or something like that.

And this may have to be combined with "nohup" to be sure that the server runs in background.

Maybe that there are other ways to do that.
What would you suggest me to do?

Please note that I have no SSH access to my account for the moment.

Thanks for your help.

sjlplat
07-20-2010, 01:09 PM
The only chat server-type applications that will be supported on Hostmonster are Flash or AJAX based, using a database to store data and a sever-side script to deliver the data. You cannot run something like an IRC server. Hostmonster does not offer the necessary shell services for this type of server. If you want to run an IRC server, try something like Kirenet at http://www.kire.net/.

aragon
07-22-2010, 06:30 AM
Hi,

Thank you for your answer.

I have written a tiny program that does nothing but sleeping (man 3 sleep), just in order to check whether the process is killed after a while. The program tests also if it is not already launched (man 1 ps). In that case, it stops immediately. Otherwise, it writes a message in a log file then sleeps until being killed.

To start the program, I have used cron jobs (http://drupal.org/node/208579).

The conclusion is that the process executes during approximatively 30 minutes, and then is killed automatically.