Skip to main content
GameDev.net gamedev.net
🔒 Locked

linux daemon..?

Started by BouncePup Aug 1, 2002 at 4:40 PM 0 replies 300+ views
Original Post
BouncePup
BouncePup
I'm working on a MMORPG server which runs as a linux daemon.. The thing is, I haven't done much linux programming before, thats the problem.. So far I have a simple terminal program that starts up, daemonizes and runs an endless while loop in the background until you send a kill signal. If anyone knows know how do any of the following, it'd be really helpful: 1) How to prevent it from running more than one instance of the daemon. 2) How to send custom signals to the server via a new terminal. (Is it possible to goto a terminal and type something like 'servername' ENTER, then get a prompt directly to it?) 3) If the above isn't possible, does anyone know of a way to issue commands to a running daemon? (Some kind of GUI maybe...?) Thanks! Nate Strandberg [edited by - nstrg on August 1, 2002 5:42:38 PM]
"Always forgive your enemies, nothing annoys them more.."
xstreme2000
xstreme2000
1) Use a lock file...
a. check if a file (''.lock'' maybe?) exists and exit if it does.
b. if not create it.
c. destroy it on exit.
... or ...
check the process table for an program with the same name already running.

2) If I understand you correctly, you want a ninternal console for you program so you can send it commands, you could try setting it up to listen on a given port which you can telnet into with a command line interface running on it (you would probably want to implement some sort of authentication).
For quick or command tasks you could trap kill signals.

If I have misunderstood your questions sorry otherwise hope it helps

goodLuckWith(*yourProject);
Tom



Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.