🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #876

Re: run java app on Linux at boot up

#876
From: Owen Green
Date: Tue, 16 Jul 2002 18:10
41 lines
2604 bytes
"Alan Shiers" <ashiers@hfx.eastlink.ca> wrote in message
news:3D346152.2E5E859D@hfx.eastlink.ca...
> "Alan Shiers" wrote:
> >MAIN OBJECTIVE: I just want to set up whatever scripts are necessary to
> >launch my java application when Linux boots up.  Linux has a special
> >command: chkconfig
> >I don't know if it can be used or not to schedule the running of a java
> >application upon boot up.  Maybe there is another, better way?
>
> >Basically, I just want to have the java application running without my
> >having to log in, except to shut it down.
>
> >Can all this be done?

Yes, but I'm hazy on the details :)

Basically, when linux boots it runs a program called init which in turn will
execute whatever scripts are set to execute for the appropriate run level.
IIRC, normal operation sans gui is run level 3.

What you need to do is
a) Write a script that starts and stops your application (you'll probably
have to monkey around with the classpath in it as well).
b) I think you then need to place the script in init.d (often found at
/etc/rc.d/init.d)
c) This is where chkconfig comes in. Use
chkconfig --level <level numbers> <scriptname> <state>

e.g.
chkconfig --level 35 myserver on   to have the server start on run levels 3
& 5
chkconfig --level 01246 mysever off for the reciprocal.

You can then check your settings with
chkconfig --list myserver

As for the script(s), have a look at the ones for tomcat to give you some
idea.

Owen
Technical Details
Message-ID: <3d346215$2_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!lsanca1-snf1!news.gtei.net!enterprise!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3D322D4F.F759335B@hfx.eastlink.ca> <MPG.179d5ff5e7b163b898b852@newsgroups.borland.com> <3D346152.2E5E859D@hfx.eastlink.ca>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,5b5327e0fa81e574
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2002-07-16 11:30:30 PST
From: "Owen Green" <owen@begonefoulmachine.kennulz.demon.co.uk>
Newsgroups: borland.public.jbuilder.java.api
References: <3D322D4F.F759335B@hfx.eastlink.ca> <MPG.179d5ff5e7b163b898b852@newsgroups.borland.com> <3D346152.2E5E859D@hfx.eastlink.ca>
Subject: Re: run java app on Linux at boot up
Date: Tue, 16 Jul 2002 19:10:20 +0100
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 193.237.54.9
Message-ID: <3d346215$2_1@dnews>
X-Trace: dnews 1026843157 193.237.54.9 (16 Jul 2002 11:12:37 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!lsanca1-snf1!news.gtei.net!enterprise!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnews