Hi everybody
I'm writing a daemon in java which is started from the console on several machines. Now, my question is, what is the easiest way to be able to start / stop daemons from the console. How can I find out if the daemon is already running (if, for example, someone wants to start it again) or how can I shut it down cleanly if it is running already? I'm thinking of something like this:
starting: [blue]java myDaemon start [additional args][/blue]
stopping: [blue]java myDaemon stop[/blue]
Somehow, I have to check if there already is a Daemon instance in the JVM when it is invoked with the start or stop argument. But I don't really know how to do this? I also don't know how to tear down (destruct) the deamon, if it is running and should be shut down??
Any help greatly appreciated
Sebastian
I'm writing a daemon in java which is started from the console on several machines. Now, my question is, what is the easiest way to be able to start / stop daemons from the console. How can I find out if the daemon is already running (if, for example, someone wants to start it again) or how can I shut it down cleanly if it is running already? I'm thinking of something like this:
starting: [blue]java myDaemon start [additional args][/blue]
stopping: [blue]java myDaemon stop[/blue]
Somehow, I have to check if there already is a Daemon instance in the JVM when it is invoked with the start or stop argument. But I don't really know how to do this? I also don't know how to tear down (destruct) the deamon, if it is running and should be shut down??
Any help greatly appreciated
Sebastian