Google Groepen ondersteunt geen nieuwe Usenet-berichten of -abonnementen meer. Historische content blijft zichtbaar.

Run java as a linux service

0 weergaven
Naar het eerste ongelezen bericht

Alessio

ongelezen,
8 sep 2003, 11:14:5108-09-2003
aan
Hi,
i must run a MyjavaApplication as a linux service, someone can help me?
alessio

Erwin Moller

ongelezen,
8 sep 2003, 11:53:1308-09-2003
aan
Alessio wrote:

Just make a startupscript and shutdownscript and put it in
/etc/rc.d/rc5.d

That is for Redhat runlevel5, which I run.
If you run another Linux-distro I guess you'll find an other appropriate
place.

In the script just run your program as you always do, like this:
java yourApp

Maybe remember the PID and store it somewhere, I am not sure how you want to
set it up.

To shutdown your program you need the PID to send it a kill-signal.

Use S55yourjavaapp and K55yourjavaapp as scriptsnames where S stands for
Startup and K for kill.
The numbers are executed in order.
So if you want your java-app to start late, use number 99, or another one
that is free.

Good luck.

Regards,
Erwin

Gordon Beaton

ongelezen,
8 sep 2003, 11:58:2108-09-2003
aan
On Mon, 08 Sep 2003 15:14:51 GMT, Alessio wrote:
> i must run a MyjavaApplication as a linux service, someone can help
> me?

If you mean that you want to put it in the background so that it will
stay there after you've logged out, then run it like this:

nohup java MyjavaApplication < /dev/null > /dev/null 2>&1 &

If you want to save its output, change the second "/dev/null" in the
example to the name of a suitable logfile.

If you meant something else, be more specific.

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e

0 nieuwe berichten