You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Daxin Zuo <dz...@techexcel.com> on 2004/09/09 23:11:16 UTC

How to create/run a Java Service on UNIX

I neeed to create a service on UNIX.( The program is in Java. this service
will serves an offline application and an online application running with
Tomcat.)

Could you please tell me how to do.

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: How to create/run a Java Service on UNIX

Posted by Leif Mortenson <le...@tanukisoftware.com>.
Daxin,
    Give the Java Service Wrapper a try.
http://wrapper.tanukisoftware.org/

    Tomcat is one of the examples used in the integration documentation:
http://wrapper.tanukisoftware.org/doc/english/integrate-start-stop-nix.html

    Cheers,
    Leif

Daxin Zuo wrote:

>I neeed to create a service on UNIX.( The program is in Java. this service
>will serves an offline application and an online application running with
>Tomcat.)
>
>Could you please tell me how to do.
>
>Thanks.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: How to create/run a Java Service on UNIX

Posted by John Villar <jo...@florhard.com>.
Well.... i'm not an expert on phoenix nor james, i "just know" about it 
and what it does.... however, you could find some information and 
examples at http://james.apache.org/

Daxin Zuo escribió:

>Could you please give more details? or example of using Phoenix and James?
>
>-----Original Message-----
>From: John Villar [mailto:john.villar@florhard.com]
>Sent: Thursday, September 09, 2004 2:30 PM
>To: Tomcat Users List
>Subject: Re: How to create/run a Java Service on UNIX
>
>
>Use the Apache Phoenix framework.... Apache James uses it....
>
>Daxin Zuo escribió:
>
>  
>
>>I neeed to create a service on UNIX.( The program is in Java. this service
>>will serves an offline application and an online application running with
>>Tomcat.)
>>
>>Could you please tell me how to do.
>>
>>Thanks.
>>
>>
>>    
>>
>John Villar
>Gerente de Proyectos
>Computadores Flor Hard Soft 2058 C.A.
>www.florhard.com
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>  
>

-- 
John Villar
Gerente de Proyectos
Computadores Flor Hard Soft 2058 C.A.
www.florhard.com



RE: How to create/run a Java Service on UNIX

Posted by Daxin Zuo <dz...@techexcel.com>.
Could you please give more details? or example of using Phoenix and James?

-----Original Message-----
From: John Villar [mailto:john.villar@florhard.com]
Sent: Thursday, September 09, 2004 2:30 PM
To: Tomcat Users List
Subject: Re: How to create/run a Java Service on UNIX


Use the Apache Phoenix framework.... Apache James uses it....

Daxin Zuo escribió:

>I neeed to create a service on UNIX.( The program is in Java. this service
>will serves an offline application and an online application running with
>Tomcat.)
>
>Could you please tell me how to do.
>
>Thanks.
>
>
John Villar
Gerente de Proyectos
Computadores Flor Hard Soft 2058 C.A.
www.florhard.com




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: How to create/run a Java Service on UNIX

Posted by John Villar <jo...@florhard.com>.
Use the Apache Phoenix framework.... Apache James uses it....

Daxin Zuo escribió:

>I neeed to create a service on UNIX.( The program is in Java. this service
>will serves an offline application and an online application running with
>Tomcat.)
>
>Could you please tell me how to do.
>
>Thanks.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>  
>

-- 
John Villar
Gerente de Proyectos
Computadores Flor Hard Soft 2058 C.A.
www.florhard.com



Re: How to create/run a Java Service on UNIX

Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
John Najarian wrote:

> It's very easy to launch a Java daemon in Linux/Unix.
> It used to be difficult & require some JNI programming.
> On the GNU site I found a slick way someone wronte in
> Java and it is simple.  What I wanted to know from the
> person asking the question is what they're trying to do
> with the 'Service'. 'Service' this is Unix not winblows.
> Get with the correct lingo! - LOL!

You should all look at http://jakarta.apache.org/commons/daemon/

There are other wrappers, but this one can be used by Tomcat, I think. 
Or is used in some binary distros.

Nix.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: How to create/run a Java Service on UNIX

Posted by Daxin Zuo <dz...@techexcel.com>.
Thank John, Mike, and Tom, and all other repliers.

I hope Tome's instruction will work. I left UNIX for a long time. What Tom
told is familiar to me. I will test it after next week.
It is still a (rare) case that the Sever is not up when one of the
applications talks to it. In this rare case, I can try else way.

Thanks again.

-----Original Message-----
From: Tom Simons [mailto:Tom.Simons@gmail.com]
Sent: Friday, September 10, 2004 1:31 PM
To: Tomcat Users List
Subject: Re: How to create/run a Java Service on UNIX


Are you just looking for Unix to start a daemon every time it boots?
That's typically done via a shell script, which accepts "start" &
"stop" arguments (sometimes "start_msg" & "stop_msg", too).  These
scripts are in /etc/init.d (/sbin/init.d for HPUX), and there are
corresponding links in /etc/rc.* directories.  Your flavor of Unix
will execute these scripts at boot time (with "startup" as the arg).
You just need to make that script execute your application program or
script.  Check out the scripts you already have - for example, the
"lp" daemon on my system has the usual shell script and 2 links:
    find /sbin -name '*lp*' | xargs ls -l          # change /sbin to
/etc, if not HPUX
    -r-xr-xr-x   1 bin  bin  1604 Oct 27  1997 /sbin/init.d/lp
    lrwxr-xr-x  1 root sys    15 Nov 16  2001 /sbin/rc1.d/K280lp ->
/sbin/init.d/lp
    lrwxr-xr-x  1 root sys    15 Nov 16  2001 /sbin/rc2.d/S720lp ->
/sbin/init.d/lp


On Fri, 10 Sep 2004 12:02:36 -0700, Daxin Zuo <dz...@techexcel.com> wrote:
> First I thank very much for the replies. Please continue forward
> instruction.
> this service, written in Java,  will serves two applications: one is
online
> with Tomcat, and another one is an offline application. these two
> applications will sometimes update the same data tables. This service will
> provide unique keys, and do something else for these two applications.
>
> This service will not depend on if Tomcat is running or not.
> I want this service on UNIX runs automatically when the computer is
started,
> and keep running.
>
> Thanks.
>
> -----Original Message-----
> From: John Najarian [mailto:j-najarian@earthlink.net]
> Sent: Thursday, September 09, 2004 8:35 PM
> To: 'Tomcat Users List'
> Subject: RE: How to create/run a Java Service on UNIX
>
> It's very easy to launch a Java daemon in Linux/Unix.
> It used to be difficult & require some JNI programming.
> On the GNU site I found a slick way someone wronte in
> Java and it is simple.  What I wanted to know from the
> person asking the question is what they're trying to do
> with the 'Service'. 'Service' this is Unix not winblows.
> Get with the correct lingo! - LOL!
>
> -----Original Message-----
> From: John Gentilin [mailto:johngapache@gentilin.org]
> Sent: Thursday, September 09, 2004 7:08 PM
> To: Tomcat Users List
> Subject: Re: How to create/run a Java Service on UNIX
>
> Sorry, missed the beginning of this thread but..
>
> I have this book
> http://half.ebay.com/cat/buy/prod.cgi?cpid=282172&meta_id=1
> and I use it often. It has a very good section on how to create a single
or
> multi threaded server. It does not go into how to launch this process as
> a daemon thread under Unix. I think all you really need to do is launch
the
> process as a background task by appending the & to the end of the
> command line.
> Look at the tomcat Catalina.sh as an example of a startup script to run
the
> service in the background.
>
> HTH
> -John G
>
> Daxin Zuo wrote:
>
> >The program is written as Java class. Does it requires special functions?
> >How to make it a service, keep running and ready to provid data?
> >Thanks.
> >
> >-----Original Message-----
> >From: Mike Curwen [mailto:g_dev9xq@globallyboundless.com]
> >Sent: Thursday, September 09, 2004 3:30 PM
> >To: 'Tomcat Users List'
> >Subject: RE: How to create/run a Java Service on UNIX
> >
> >
> >So you've already written this java program, and it has a public static
> void
> >main() method, and it all interfaces properly with what you need it to,
and
> >you just want to know how to make it start when your UNIX box starts?
> >
> >Or you haven't written the program yet at all, and you want to know how
to
> >go about doing so?
> >
> >
> >

> >
> >>-----Original Message-----
> >>From: Daxin Zuo [mailto:dzuo@techexcel.com]
> >>Sent: Thursday, September 09, 2004 5:19 PM
> >>To: Tomcat Users List
> >>Subject: RE: How to create/run a Java Service on UNIX
> >>
> >>
> >>Yes. It keep running and sometimes it replies and provides
> >>some data for other applications.
> >>
> >>-----Original Message-----
> >>From: John Najarian [mailto:j-najarian@earthlink.net]
> >>Sent: Thursday, September 09, 2004 2:59 PM
> >>To: 'Tomcat Users List'
> >>Subject: RE: How to create/run a Java Service on UNIX
> >>
> >>
> >>Do you want to run this as a daemon?
> >>
> >>
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: How to create/run a Java Service on UNIX

Posted by Tom Simons <To...@gmail.com>.
Are you just looking for Unix to start a daemon every time it boots? 
That's typically done via a shell script, which accepts "start" &
"stop" arguments (sometimes "start_msg" & "stop_msg", too).  These
scripts are in /etc/init.d (/sbin/init.d for HPUX), and there are
corresponding links in /etc/rc.* directories.  Your flavor of Unix
will execute these scripts at boot time (with "startup" as the arg). 
You just need to make that script execute your application program or
script.  Check out the scripts you already have - for example, the
"lp" daemon on my system has the usual shell script and 2 links:
    find /sbin -name '*lp*' | xargs ls -l          # change /sbin to
/etc, if not HPUX
    -r-xr-xr-x   1 bin  bin  1604 Oct 27  1997 /sbin/init.d/lp
    lrwxr-xr-x  1 root sys    15 Nov 16  2001 /sbin/rc1.d/K280lp ->
/sbin/init.d/lp
    lrwxr-xr-x  1 root sys    15 Nov 16  2001 /sbin/rc2.d/S720lp ->
/sbin/init.d/lp


On Fri, 10 Sep 2004 12:02:36 -0700, Daxin Zuo <dz...@techexcel.com> wrote:
> First I thank very much for the replies. Please continue forward
> instruction.
> this service, written in Java,  will serves two applications: one is online
> with Tomcat, and another one is an offline application. these two
> applications will sometimes update the same data tables. This service will
> provide unique keys, and do something else for these two applications.
> 
> This service will not depend on if Tomcat is running or not.
> I want this service on UNIX runs automatically when the computer is started,
> and keep running.
> 
> Thanks.
> 
> -----Original Message-----
> From: John Najarian [mailto:j-najarian@earthlink.net]
> Sent: Thursday, September 09, 2004 8:35 PM
> To: 'Tomcat Users List'
> Subject: RE: How to create/run a Java Service on UNIX
> 
> It's very easy to launch a Java daemon in Linux/Unix.
> It used to be difficult & require some JNI programming.
> On the GNU site I found a slick way someone wronte in
> Java and it is simple.  What I wanted to know from the
> person asking the question is what they're trying to do
> with the 'Service'. 'Service' this is Unix not winblows.
> Get with the correct lingo! - LOL!
> 
> -----Original Message-----
> From: John Gentilin [mailto:johngapache@gentilin.org]
> Sent: Thursday, September 09, 2004 7:08 PM
> To: Tomcat Users List
> Subject: Re: How to create/run a Java Service on UNIX
> 
> Sorry, missed the beginning of this thread but..
> 
> I have this book
> http://half.ebay.com/cat/buy/prod.cgi?cpid=282172&meta_id=1
> and I use it often. It has a very good section on how to create a single or
> multi threaded server. It does not go into how to launch this process as
> a daemon thread under Unix. I think all you really need to do is launch the
> process as a background task by appending the & to the end of the
> command line.
> Look at the tomcat Catalina.sh as an example of a startup script to run the
> service in the background.
> 
> HTH
> -John G
> 
> Daxin Zuo wrote:
> 
> >The program is written as Java class. Does it requires special functions?
> >How to make it a service, keep running and ready to provid data?
> >Thanks.
> >
> >-----Original Message-----
> >From: Mike Curwen [mailto:g_dev9xq@globallyboundless.com]
> >Sent: Thursday, September 09, 2004 3:30 PM
> >To: 'Tomcat Users List'
> >Subject: RE: How to create/run a Java Service on UNIX
> >
> >
> >So you've already written this java program, and it has a public static
> void
> >main() method, and it all interfaces properly with what you need it to, and
> >you just want to know how to make it start when your UNIX box starts?
> >
> >Or you haven't written the program yet at all, and you want to know how to
> >go about doing so?
> >
> >
> >

> >
> >>-----Original Message-----
> >>From: Daxin Zuo [mailto:dzuo@techexcel.com]
> >>Sent: Thursday, September 09, 2004 5:19 PM
> >>To: Tomcat Users List
> >>Subject: RE: How to create/run a Java Service on UNIX
> >>
> >>
> >>Yes. It keep running and sometimes it replies and provides
> >>some data for other applications.
> >>
> >>-----Original Message-----
> >>From: John Najarian [mailto:j-najarian@earthlink.net]
> >>Sent: Thursday, September 09, 2004 2:59 PM
> >>To: 'Tomcat Users List'
> >>Subject: RE: How to create/run a Java Service on UNIX
> >>
> >>
> >>Do you want to run this as a daemon?
> >>
> >>
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: How to create/run a Java Service on UNIX

Posted by Mike Curwen <g_...@globallyboundless.com>.
I think we should assume that 'the program' will function correctly and do
what it's advertised to do, since if that was the actual problem, then a
list like 'java-rmi-user' or 'java-io-user' would be more appropriate. 

The tomcat application, and that second application should be coded to
handle the cases when 'the program' is not available. If that's still a
problem, refer to the aformentioned, fictious(?) groups.  

All that remains is "how do I get 'the program' to run?" Oddly enough,
that's still not tomcat-user, but hey we like to help out.
 
For that (as Yoav said), you need a *nix admin type person to write some rc
scripts for you, or investigate how to do so for yourself. Find a BB or
other email-user list for the exact flavour of *nix you are running, and ask
about rc.d scripts on that list. (rc.d is the approximate equivalent on
*nix, of the Windows Services control panel).




> -----Original Message-----
> From: John Najarian [mailto:j-najarian@earthlink.net] 
> Sent: Friday, September 10, 2004 2:28 PM
> To: 'Tomcat Users List'
> Subject: RE: How to create/run a Java Service on UNIX
> 
> 
> Hi Daxin,
> 
>    How are you going to genereate the keys?  Via the 
> database?  Also, seeing as you are going to use 'service' 
> with & without Tomcat I'd like to know if either application 
> will be up as long as the server(s) is up.  If that's the 
> case you could have both applications check at startup if the 
> daemon is
> active(running) or not not.  If the daemon isn't active 
> either application could start it.  If this service should be 
> up whenever the hardware is up you could start the service on 
> boot so it is in theory always available to the 2 
> applications when they are started but each must check if the 
> daemon is running prior to accessing the daemon.
> 
>    The person who recommended learning daemons was entirely 
> right and without my knowing more of the 2 applications I can 
> not tell you more except since tomcat will access he daemon, 
> I would look closely at the framework in Jakarta to see if it 
> will suit both applications.  I haven't looked at it closely 
> and it Tomcat must be running for the daemon to be running(which I
> doubt) I wouldn't utilize that framework.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: How to create/run a Java Service on UNIX

Posted by John Najarian <j-...@earthlink.net>.
Hi Daxin,

   How are you going to genereate the keys?  Via the database?  Also, seeing
as you are going to use 'service' with & without Tomcat I'd like to know if
either application will be up as long as the server(s) is up.  If that's the
case you could have both applications check at startup if the daemon is
active(running) or not not.  If the daemon isn't active either application
could start it.  If this service should be up whenever the hardware is up
you could start the service on boot so it is in theory always available to
the 2 applications when they are started but each must check if the daemon
is running prior to accessing the daemon.

   The person who recommended learning daemons was entirely right and
without my knowing more of the 2 applications I can not tell you more except
since tomcat will access he daemon, I would look closely at the framework in
Jakarta to see if it will suit both applications.  I haven't looked at it
closely and it Tomcat must be running for the daemon to be running(which I
doubt) I wouldn't utilize that framework.

-----Original Message-----
From: Daxin Zuo [mailto:dzuo@techexcel.com] 
Sent: Friday, September 10, 2004 12:03 PM
To: Tomcat Users List
Subject: RE: How to create/run a Java Service on UNIX

First I thank very much for the replies. Please continue forward
instruction.
this service, written in Java,  will serves two applications: one is online
with Tomcat, and another one is an offline application. these two
applications will sometimes update the same data tables. This service will
provide unique keys, and do something else for these two applications.

This service will not depend on if Tomcat is running or not.
I want this service on UNIX runs automatically when the computer is started,
and keep running.

Thanks.

-----Original Message-----
From: John Najarian [mailto:j-najarian@earthlink.net]
Sent: Thursday, September 09, 2004 8:35 PM
To: 'Tomcat Users List'
Subject: RE: How to create/run a Java Service on UNIX


It's very easy to launch a Java daemon in Linux/Unix.
It used to be difficult & require some JNI programming.
On the GNU site I found a slick way someone wronte in
Java and it is simple.  What I wanted to know from the
person asking the question is what they're trying to do
with the 'Service'. 'Service' this is Unix not winblows.
Get with the correct lingo! - LOL!

-----Original Message-----
From: John Gentilin [mailto:johngapache@gentilin.org]
Sent: Thursday, September 09, 2004 7:08 PM
To: Tomcat Users List
Subject: Re: How to create/run a Java Service on UNIX

Sorry, missed the beginning of this thread but..

I have this book
http://half.ebay.com/cat/buy/prod.cgi?cpid=282172&meta_id=1
and I use it often. It has a very good section on how to create a single or
multi threaded server. It does not go into how to launch this process as
a daemon thread under Unix. I think all you really need to do is launch the
process as a background task by appending the & to the end of the
command line.
Look at the tomcat Catalina.sh as an example of a startup script to run the
service in the background.

HTH
-John G

Daxin Zuo wrote:

>The program is written as Java class. Does it requires special functions?
>How to make it a service, keep running and ready to provid data?
>Thanks.
>
>-----Original Message-----
>From: Mike Curwen [mailto:g_dev9xq@globallyboundless.com]
>Sent: Thursday, September 09, 2004 3:30 PM
>To: 'Tomcat Users List'
>Subject: RE: How to create/run a Java Service on UNIX
>
>
>So you've already written this java program, and it has a public static
void
>main() method, and it all interfaces properly with what you need it to, and
>you just want to know how to make it start when your UNIX box starts?
>
>Or you haven't written the program yet at all, and you want to know how to
>go about doing so?
>
>
>
>
>>-----Original Message-----
>>From: Daxin Zuo [mailto:dzuo@techexcel.com]
>>Sent: Thursday, September 09, 2004 5:19 PM
>>To: Tomcat Users List
>>Subject: RE: How to create/run a Java Service on UNIX
>>
>>
>>Yes. It keep running and sometimes it replies and provides
>>some data for other applications.
>>
>>-----Original Message-----
>>From: John Najarian [mailto:j-najarian@earthlink.net]
>>Sent: Thursday, September 09, 2004 2:59 PM
>>To: 'Tomcat Users List'
>>Subject: RE: How to create/run a Java Service on UNIX
>>
>>
>>Do you want to run this as a daemon?
>>
>>
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: How to create/run a Java Service on UNIX

Posted by Daxin Zuo <dz...@techexcel.com>.
First I thank very much for the replies. Please continue forward
instruction.
this service, written in Java,  will serves two applications: one is online
with Tomcat, and another one is an offline application. these two
applications will sometimes update the same data tables. This service will
provide unique keys, and do something else for these two applications.

This service will not depend on if Tomcat is running or not.
I want this service on UNIX runs automatically when the computer is started,
and keep running.

Thanks.

-----Original Message-----
From: John Najarian [mailto:j-najarian@earthlink.net]
Sent: Thursday, September 09, 2004 8:35 PM
To: 'Tomcat Users List'
Subject: RE: How to create/run a Java Service on UNIX


It's very easy to launch a Java daemon in Linux/Unix.
It used to be difficult & require some JNI programming.
On the GNU site I found a slick way someone wronte in
Java and it is simple.  What I wanted to know from the
person asking the question is what they're trying to do
with the 'Service'. 'Service' this is Unix not winblows.
Get with the correct lingo! - LOL!

-----Original Message-----
From: John Gentilin [mailto:johngapache@gentilin.org]
Sent: Thursday, September 09, 2004 7:08 PM
To: Tomcat Users List
Subject: Re: How to create/run a Java Service on UNIX

Sorry, missed the beginning of this thread but..

I have this book
http://half.ebay.com/cat/buy/prod.cgi?cpid=282172&meta_id=1
and I use it often. It has a very good section on how to create a single or
multi threaded server. It does not go into how to launch this process as
a daemon thread under Unix. I think all you really need to do is launch the
process as a background task by appending the & to the end of the
command line.
Look at the tomcat Catalina.sh as an example of a startup script to run the
service in the background.

HTH
-John G

Daxin Zuo wrote:

>The program is written as Java class. Does it requires special functions?
>How to make it a service, keep running and ready to provid data?
>Thanks.
>
>-----Original Message-----
>From: Mike Curwen [mailto:g_dev9xq@globallyboundless.com]
>Sent: Thursday, September 09, 2004 3:30 PM
>To: 'Tomcat Users List'
>Subject: RE: How to create/run a Java Service on UNIX
>
>
>So you've already written this java program, and it has a public static
void
>main() method, and it all interfaces properly with what you need it to, and
>you just want to know how to make it start when your UNIX box starts?
>
>Or you haven't written the program yet at all, and you want to know how to
>go about doing so?
>
>
>
>
>>-----Original Message-----
>>From: Daxin Zuo [mailto:dzuo@techexcel.com]
>>Sent: Thursday, September 09, 2004 5:19 PM
>>To: Tomcat Users List
>>Subject: RE: How to create/run a Java Service on UNIX
>>
>>
>>Yes. It keep running and sometimes it replies and provides
>>some data for other applications.
>>
>>-----Original Message-----
>>From: John Najarian [mailto:j-najarian@earthlink.net]
>>Sent: Thursday, September 09, 2004 2:59 PM
>>To: 'Tomcat Users List'
>>Subject: RE: How to create/run a Java Service on UNIX
>>
>>
>>Do you want to run this as a daemon?
>>
>>
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: How to create/run a Java Service on UNIX

Posted by John Najarian <j-...@earthlink.net>.
It's very easy to launch a Java daemon in Linux/Unix.
It used to be difficult & require some JNI programming.
On the GNU site I found a slick way someone wronte in
Java and it is simple.  What I wanted to know from the
person asking the question is what they're trying to do
with the 'Service'. 'Service' this is Unix not winblows.
Get with the correct lingo! - LOL!

-----Original Message-----
From: John Gentilin [mailto:johngapache@gentilin.org] 
Sent: Thursday, September 09, 2004 7:08 PM
To: Tomcat Users List
Subject: Re: How to create/run a Java Service on UNIX

Sorry, missed the beginning of this thread but..

I have this book 
http://half.ebay.com/cat/buy/prod.cgi?cpid=282172&meta_id=1
and I use it often. It has a very good section on how to create a single or
multi threaded server. It does not go into how to launch this process as 
a daemon thread under Unix. I think all you really need to do is launch the
process as a background task by appending the & to the end of the 
command line.
Look at the tomcat Catalina.sh as an example of a startup script to run the
service in the background.

HTH
-John G

Daxin Zuo wrote:

>The program is written as Java class. Does it requires special functions?
>How to make it a service, keep running and ready to provid data?
>Thanks.
>
>-----Original Message-----
>From: Mike Curwen [mailto:g_dev9xq@globallyboundless.com]
>Sent: Thursday, September 09, 2004 3:30 PM
>To: 'Tomcat Users List'
>Subject: RE: How to create/run a Java Service on UNIX
>
>
>So you've already written this java program, and it has a public static
void
>main() method, and it all interfaces properly with what you need it to, and
>you just want to know how to make it start when your UNIX box starts?
>
>Or you haven't written the program yet at all, and you want to know how to
>go about doing so?
>
>
>  
>
>>-----Original Message-----
>>From: Daxin Zuo [mailto:dzuo@techexcel.com]
>>Sent: Thursday, September 09, 2004 5:19 PM
>>To: Tomcat Users List
>>Subject: RE: How to create/run a Java Service on UNIX
>>
>>
>>Yes. It keep running and sometimes it replies and provides
>>some data for other applications.
>>
>>-----Original Message-----
>>From: John Najarian [mailto:j-najarian@earthlink.net]
>>Sent: Thursday, September 09, 2004 2:59 PM
>>To: 'Tomcat Users List'
>>Subject: RE: How to create/run a Java Service on UNIX
>>
>>
>>Do you want to run this as a daemon?
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: How to create/run a Java Service on UNIX

Posted by John Gentilin <jo...@gentilin.org>.
Sorry, missed the beginning of this thread but..

I have this book 
http://half.ebay.com/cat/buy/prod.cgi?cpid=282172&meta_id=1
and I use it often. It has a very good section on how to create a single or
multi threaded server. It does not go into how to launch this process as 
a daemon thread under Unix. I think all you really need to do is launch the
process as a background task by appending the & to the end of the 
command line.
Look at the tomcat Catalina.sh as an example of a startup script to run the
service in the background.

HTH
-John G

Daxin Zuo wrote:

>The program is written as Java class. Does it requires special functions?
>How to make it a service, keep running and ready to provid data?
>Thanks.
>
>-----Original Message-----
>From: Mike Curwen [mailto:g_dev9xq@globallyboundless.com]
>Sent: Thursday, September 09, 2004 3:30 PM
>To: 'Tomcat Users List'
>Subject: RE: How to create/run a Java Service on UNIX
>
>
>So you've already written this java program, and it has a public static void
>main() method, and it all interfaces properly with what you need it to, and
>you just want to know how to make it start when your UNIX box starts?
>
>Or you haven't written the program yet at all, and you want to know how to
>go about doing so?
>
>
>  
>
>>-----Original Message-----
>>From: Daxin Zuo [mailto:dzuo@techexcel.com]
>>Sent: Thursday, September 09, 2004 5:19 PM
>>To: Tomcat Users List
>>Subject: RE: How to create/run a Java Service on UNIX
>>
>>
>>Yes. It keep running and sometimes it replies and provides
>>some data for other applications.
>>
>>-----Original Message-----
>>From: John Najarian [mailto:j-najarian@earthlink.net]
>>Sent: Thursday, September 09, 2004 2:59 PM
>>To: 'Tomcat Users List'
>>Subject: RE: How to create/run a Java Service on UNIX
>>
>>
>>Do you want to run this as a daemon?
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: How to create/run a Java Service on UNIX

Posted by Daxin Zuo <dz...@techexcel.com>.
The program is written as Java class. Does it requires special functions?
How to make it a service, keep running and ready to provid data?
Thanks.

-----Original Message-----
From: Mike Curwen [mailto:g_dev9xq@globallyboundless.com]
Sent: Thursday, September 09, 2004 3:30 PM
To: 'Tomcat Users List'
Subject: RE: How to create/run a Java Service on UNIX


So you've already written this java program, and it has a public static void
main() method, and it all interfaces properly with what you need it to, and
you just want to know how to make it start when your UNIX box starts?

Or you haven't written the program yet at all, and you want to know how to
go about doing so?


> -----Original Message-----
> From: Daxin Zuo [mailto:dzuo@techexcel.com]
> Sent: Thursday, September 09, 2004 5:19 PM
> To: Tomcat Users List
> Subject: RE: How to create/run a Java Service on UNIX
>
>
> Yes. It keep running and sometimes it replies and provides
> some data for other applications.
>
> -----Original Message-----
> From: John Najarian [mailto:j-najarian@earthlink.net]
> Sent: Thursday, September 09, 2004 2:59 PM
> To: 'Tomcat Users List'
> Subject: RE: How to create/run a Java Service on UNIX
>
>
> Do you want to run this as a daemon?
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: How to create/run a Java Service on UNIX

Posted by Daxin Zuo <dz...@techexcel.com>.
The program is written as Java class. It has Socket read/write features.
Does it requires special functions? How to make it as a service, keep
running and ready to provid data when the Unix box startup?
Thanks.


-----Original Message-----
From: John Najarian [mailto:j-najarian@earthlink.net]
Sent: Thursday, September 09, 2004 3:39 PM
To: 'Tomcat Users List'
Subject: RE: How to create/run a Java Service on UNIX


That's why I asked if it can be run as a daemon.

-----Original Message-----
From: Mike Curwen [mailto:g_dev9xq@globallyboundless.com]
Sent: Thursday, September 09, 2004 3:30 PM
To: 'Tomcat Users List'
Subject: RE: How to create/run a Java Service on UNIX

So you've already written this java program, and it has a public static void
main() method, and it all interfaces properly with what you need it to, and
you just want to know how to make it start when your UNIX box starts?

Or you haven't written the program yet at all, and you want to know how to
go about doing so?


> -----Original Message-----
> From: Daxin Zuo [mailto:dzuo@techexcel.com]
> Sent: Thursday, September 09, 2004 5:19 PM
> To: Tomcat Users List
> Subject: RE: How to create/run a Java Service on UNIX
>
>
> Yes. It keep running and sometimes it replies and provides
> some data for other applications.
>
> -----Original Message-----
> From: John Najarian [mailto:j-najarian@earthlink.net]
> Sent: Thursday, September 09, 2004 2:59 PM
> To: 'Tomcat Users List'
> Subject: RE: How to create/run a Java Service on UNIX
>
>
> Do you want to run this as a daemon?
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: How to create/run a Java Service on UNIX

Posted by John Najarian <j-...@earthlink.net>.
That's why I asked if it can be run as a daemon.

-----Original Message-----
From: Mike Curwen [mailto:g_dev9xq@globallyboundless.com] 
Sent: Thursday, September 09, 2004 3:30 PM
To: 'Tomcat Users List'
Subject: RE: How to create/run a Java Service on UNIX

So you've already written this java program, and it has a public static void
main() method, and it all interfaces properly with what you need it to, and
you just want to know how to make it start when your UNIX box starts?
 
Or you haven't written the program yet at all, and you want to know how to
go about doing so?


> -----Original Message-----
> From: Daxin Zuo [mailto:dzuo@techexcel.com] 
> Sent: Thursday, September 09, 2004 5:19 PM
> To: Tomcat Users List
> Subject: RE: How to create/run a Java Service on UNIX
> 
> 
> Yes. It keep running and sometimes it replies and provides 
> some data for other applications.
> 
> -----Original Message-----
> From: John Najarian [mailto:j-najarian@earthlink.net]
> Sent: Thursday, September 09, 2004 2:59 PM
> To: 'Tomcat Users List'
> Subject: RE: How to create/run a Java Service on UNIX
> 
> 
> Do you want to run this as a daemon?
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: How to create/run a Java Service on UNIX

Posted by Mike Curwen <g_...@globallyboundless.com>.
So you've already written this java program, and it has a public static void
main() method, and it all interfaces properly with what you need it to, and
you just want to know how to make it start when your UNIX box starts?
 
Or you haven't written the program yet at all, and you want to know how to
go about doing so?


> -----Original Message-----
> From: Daxin Zuo [mailto:dzuo@techexcel.com] 
> Sent: Thursday, September 09, 2004 5:19 PM
> To: Tomcat Users List
> Subject: RE: How to create/run a Java Service on UNIX
> 
> 
> Yes. It keep running and sometimes it replies and provides 
> some data for other applications.
> 
> -----Original Message-----
> From: John Najarian [mailto:j-najarian@earthlink.net]
> Sent: Thursday, September 09, 2004 2:59 PM
> To: 'Tomcat Users List'
> Subject: RE: How to create/run a Java Service on UNIX
> 
> 
> Do you want to run this as a daemon?
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: How to create/run a Java Service on UNIX

Posted by Daxin Zuo <dz...@techexcel.com>.
Yes. It keep running and sometimes it replies and provides some data for
other applications.

-----Original Message-----
From: John Najarian [mailto:j-najarian@earthlink.net]
Sent: Thursday, September 09, 2004 2:59 PM
To: 'Tomcat Users List'
Subject: RE: How to create/run a Java Service on UNIX


Do you want to run this as a daemon?

-----Original Message-----
From: Daxin Zuo [mailto:dzuo@techexcel.com]
Sent: Thursday, September 09, 2004 2:11 PM
To: Tomcat Users List
Subject: How to create/run a Java Service on UNIX

I neeed to create a service on UNIX.( The program is in Java. this service
will serves an offline application and an online application running with
Tomcat.)

Could you please tell me how to do.

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: How to create/run a Java Service on UNIX

Posted by John Najarian <j-...@earthlink.net>.
Do you want to run this as a daemon?

-----Original Message-----
From: Daxin Zuo [mailto:dzuo@techexcel.com] 
Sent: Thursday, September 09, 2004 2:11 PM
To: Tomcat Users List
Subject: How to create/run a Java Service on UNIX

I neeed to create a service on UNIX.( The program is in Java. this service
will serves an offline application and an online application running with
Tomcat.)

Could you please tell me how to do.

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org