You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "dimitryous r." <04...@edelphy.com> on 2007/03/26 00:13:38 UTC
Launching Tomcat at boot
Hello,
Is there a way for me to launch my Apache Tomcat server automatically
at each boot?
Right now I have to launch Terminal.app and then type "/usr/local/bin/
start_tomcat" (or paste the stuff).
Result ok at http://192/168/0/1:8080 .
I tried to put the the following code - the file name is tomcat.plist
- in the "/Library/LaunchDaemons/" root folder, but after reboot,
nothing in browser at the above address.
*** no success ***
beg code ___
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://
www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>tomcat.plist</key>
<string>apache-tomcat-5.5.20</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/start_tomcat</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>OnDemand</key>
<true/>
</dict>
</plist>
end code ___
My start_tomcat contain the following code:
beg code ___
#!/bin/sh
export CATALINA_HOME=/usr/local/apache-tomcat-5.5.20
export JAVA_HOME=/usr
$CATALINA_HOME/bin/startup.sh
end code ___
Is there someting wrong with my code(s)?
Wrong approach?
TIA
MacBookPro: MacOSX 10.4.9
Re: Launching Tomcat at boot = Problem solved.
Posted by "dimitryous r." <04...@edelphy.com>.
Thank you Edoardo, it works fine...
Problem solved.
Thank you all
On 26 mars 07, at 09:33, Edoardo Panfili wrote:
> dimitryous r. wrote:
>> Hello Hassan,
>> My question was "Launching Tomcat automatically at boot" ...
>> The fact is:
>> either "export JAVA_HOME=/usr"
>> or "export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/
>> Versions/1.5.0/Home"
>> are both OK. Seem Apple is promoting the 1st one? Strange but will
>> not challenge them.
>> Problem is: I'm tired to open terminal.app and "usr/local/bin/
>> start_tomcat" when I reboot/restart my Mac. This is the way I do
>> it now and http://192.168.0.1:8080 give me the expected result.
>> Here is my new code for "start_tomcat":
>> beg code ___
>> #!/bin/sh
>> export CATALINA_HOME=/usr/local/apache-tomcat-5.5.20
>> export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/
>> Versions/1.5.0/Home
>> $CATALINA_HOME/bin/startup.sh
>> echo "The start_tomcat script ran." >>/Users/der/
>> start_tomcat_out.txt // (that is /usr/local/
>> tart_tomcat_out.txt ...)
>> end code ___
>> (I'm a Java developer and has to travel a lot with my MacBook_Pro,
>> home and abroad.
>> In order to speed up things, I would prefer to have the server
>> launched at startup without copy/paste some stuff in the
>> terminal.app.)
>> The link http://www.macdevcenter.com/pub/a/mac/2002/06/18/
>> tomcat.html?page=last is proposing a way to do it, but don't work.
>> Then I tried to put some code - a file named "tomcat.plist" in /
>> Library/LaunchDaemons/ but I get an error...
>> Here is my new code for "tomcat.plist":
>> beg code ___
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
>> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
>> <plist version="1.0">
>> <dict>
>> <key>tomcat</key>
>> <string>apache-tomcat-5.5.20</string>
>> <key>ProgramArguments</key>
>> <array>
>> <string>/usr/local/bin/start_tomcat</string>
>> </array>
>> <key>RunAtLoad</key>
>> <true/>
>> <key>OnDemand</key>
>> <true/>
>> </dict>
>> </plist>
>> end code ___
>> When I test with "launchctl load /Library/LaunchDaemons/
>> tomcat.plist" in terminal.app the error is:
>> Last login: Mon Mar 26 08:07:45 on console
>> sudo sh -s
>> Welcome to Darwin!
>> MacBook-Pro:~ der$ sudo sh -s
>> Password:
>> sh-2.05b# launchctl load /Library/LaunchDaemons/tomcat.plist
>> launchctl: missing the Label key: /Library/LaunchDaemons/
>> tomcat.plist ???
>> nothing found to load ???
>> sh-2.05b#
>> Sure that if I restart My Mac, will get nothig out of this...
>> Please help...
>> And thank you for all the answers I received.
>> Keep on the good work.
>> On 26 mars 07, at 04:01, Hassan Schroeder wrote:
>>> On 3/25/07, David Harrison <da...@stress-free.co.nz> wrote:
>>>
>>>> Either way works but Apple seems to promote the JAVA_HOME=/usr
>>>> alternative:
>>>
>>> Um, an article citing Tomcat *4.0.1* as "the latest"? OK....
>>>
>>> Let's just say: my startup script works, the OP's doesn't. You're
>>> more
>>> than welcome to adhere to the approach of your choice. :-)
>>>
>>> --
> I use Tomcat 5.5 on Mac OS X 10.3.9
> This is the way that I use to start Tomcat as boot time.
>
> Place a new directory "Tomcat" in /System/Library/StartupItems
> In that directory there are 2 files
>
> StartupParameters.plist---------------------------------------
> {
> Description = "Tomcat Servlet container";
> Provides = ("Servlet container");
> Requires = ("postgres");
> Uses = ("Network time");
> OrderPreference = "Last";
> Messages =
> {
> start = "Starting Tomcat";
> stop = "Stopping Tomcat";
> };
> }
> --------------------------------------------------------------
> You can remove "Requires = ("postgres");"
> but I need it
>
> and
>
> Tomcat--------------------------------------------------------
> #!/bin/sh
>
> . /etc/rc.common
>
> export JAVA_HOME=/usr/
>
> StartService ()
> {
> if [ "${SERVLETCONTAINER:=-NO-}" = "-YES-" ]; then
> ConsoleMessage "Starting servelt container"
> /usr/local/tomcat/bin/startup.sh
> fi
> }
>
> StopService ()
> {
> ConsoleMessage "Stopping servlet container"
> /usr/local/tomcat/bin/shutdown.sh
> }
>
> RunService "$1"
> --------------------------------------------------------------
>
> in /etc/hostconfig there is a line:
> SERVLETCONTAINER=-YES-
>
> I hope that it works also for 10.4
> Edoardo
>
>
> --
> edoardo@aspix.it
> AIM: edoardopn
> Jabber: edoardopa@talk.google.com
> tel:075 9142766
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Launching Tomcat at boot, at boot, at boot
Posted by Edoardo Panfili <ed...@aspix.it>.
dimitryous r. wrote:
> Hello Hassan,
>
> My question was "Launching Tomcat automatically at boot" ...
>
> The fact is:
> either "export JAVA_HOME=/usr"
> or "export
> JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home"
> are both OK. Seem Apple is promoting the 1st one? Strange but will not
> challenge them.
>
> Problem is: I'm tired to open terminal.app and
> "usr/local/bin/start_tomcat" when I reboot/restart my Mac. This is the
> way I do it now and http://192.168.0.1:8080 give me the expected result.
>
> Here is my new code for "start_tomcat":
> beg code ___
> #!/bin/sh
> export CATALINA_HOME=/usr/local/apache-tomcat-5.5.20
> export
> JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
> $CATALINA_HOME/bin/startup.sh
> echo "The start_tomcat script ran."
> >>/Users/der/start_tomcat_out.txt // (that is
> /usr/local/tart_tomcat_out.txt ...)
> end code ___
>
> (I'm a Java developer and has to travel a lot with my MacBook_Pro, home
> and abroad.
> In order to speed up things, I would prefer to have the server launched
> at startup without copy/paste some stuff in the terminal.app.)
>
> The link
> http://www.macdevcenter.com/pub/a/mac/2002/06/18/tomcat.html?page=last
> is proposing a way to do it, but don't work.
>
> Then I tried to put some code - a file named "tomcat.plist" in
> /Library/LaunchDaemons/ but I get an error...
> Here is my new code for "tomcat.plist":
> beg code ___
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> <plist version="1.0">
> <dict>
> <key>tomcat</key>
> <string>apache-tomcat-5.5.20</string>
> <key>ProgramArguments</key>
> <array>
> <string>/usr/local/bin/start_tomcat</string>
> </array>
> <key>RunAtLoad</key>
> <true/>
> <key>OnDemand</key>
> <true/>
> </dict>
> </plist>
> end code ___
>
> When I test with "launchctl load /Library/LaunchDaemons/tomcat.plist" in
> terminal.app the error is:
> Last login: Mon Mar 26 08:07:45 on console
> sudo sh -s
> Welcome to Darwin!
> MacBook-Pro:~ der$ sudo sh -s
> Password:
> sh-2.05b# launchctl load /Library/LaunchDaemons/tomcat.plist
> launchctl: missing the Label key:
> /Library/LaunchDaemons/tomcat.plist ???
> nothing found to load ???
> sh-2.05b#
>
> Sure that if I restart My Mac, will get nothig out of this...
>
> Please help...
>
> And thank you for all the answers I received.
> Keep on the good work.
> On 26 mars 07, at 04:01, Hassan Schroeder wrote:
>
>> On 3/25/07, David Harrison <da...@stress-free.co.nz> wrote:
>>
>>> Either way works but Apple seems to promote the JAVA_HOME=/usr
>>> alternative:
>>
>> Um, an article citing Tomcat *4.0.1* as "the latest"? OK....
>>
>> Let's just say: my startup script works, the OP's doesn't. You're more
>> than welcome to adhere to the approach of your choice. :-)
>>
>> --
I use Tomcat 5.5 on Mac OS X 10.3.9
This is the way that I use to start Tomcat as boot time.
Place a new directory "Tomcat" in /System/Library/StartupItems
In that directory there are 2 files
StartupParameters.plist---------------------------------------
{
Description = "Tomcat Servlet container";
Provides = ("Servlet container");
Requires = ("postgres");
Uses = ("Network time");
OrderPreference = "Last";
Messages =
{
start = "Starting Tomcat";
stop = "Stopping Tomcat";
};
}
--------------------------------------------------------------
You can remove "Requires = ("postgres");"
but I need it
and
Tomcat--------------------------------------------------------
#!/bin/sh
. /etc/rc.common
export JAVA_HOME=/usr/
StartService ()
{
if [ "${SERVLETCONTAINER:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Starting servelt container"
/usr/local/tomcat/bin/startup.sh
fi
}
StopService ()
{
ConsoleMessage "Stopping servlet container"
/usr/local/tomcat/bin/shutdown.sh
}
RunService "$1"
--------------------------------------------------------------
in /etc/hostconfig there is a line:
SERVLETCONTAINER=-YES-
I hope that it works also for 10.4
Edoardo
--
edoardo@aspix.it
AIM: edoardopn
Jabber: edoardopa@talk.google.com
tel:075 9142766
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Launching Tomcat at boot, at boot, at boot
Posted by "dimitryous r." <04...@edelphy.com>.
Hello Hassan,
My question was "Launching Tomcat automatically at boot" ...
The fact is:
either "export JAVA_HOME=/usr"
or "export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/
Versions/1.5.0/Home"
are both OK. Seem Apple is promoting the 1st one? Strange but will
not challenge them.
Problem is: I'm tired to open terminal.app and "usr/local/bin/
start_tomcat" when I reboot/restart my Mac. This is the way I do it
now and http://192.168.0.1:8080 give me the expected result.
Here is my new code for "start_tomcat":
beg code ___
#!/bin/sh
export CATALINA_HOME=/usr/local/apache-tomcat-5.5.20
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/
1.5.0/Home
$CATALINA_HOME/bin/startup.sh
echo "The start_tomcat script ran." >>/Users/der/
start_tomcat_out.txt // (that is /usr/local/
tart_tomcat_out.txt ...)
end code ___
(I'm a Java developer and has to travel a lot with my MacBook_Pro,
home and abroad.
In order to speed up things, I would prefer to have the server
launched at startup without copy/paste some stuff in the terminal.app.)
The link http://www.macdevcenter.com/pub/a/mac/2002/06/18/tomcat.html?
page=last is proposing a way to do it, but don't work.
Then I tried to put some code - a file named "tomcat.plist" in /
Library/LaunchDaemons/ but I get an error...
Here is my new code for "tomcat.plist":
beg code ___
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://
www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>tomcat</key>
<string>apache-tomcat-5.5.20</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/start_tomcat</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>OnDemand</key>
<true/>
</dict>
</plist>
end code ___
When I test with "launchctl load /Library/LaunchDaemons/tomcat.plist"
in terminal.app the error is:
Last login: Mon Mar 26 08:07:45 on console
sudo sh -s
Welcome to Darwin!
MacBook-Pro:~ der$ sudo sh -s
Password:
sh-2.05b# launchctl load /Library/LaunchDaemons/tomcat.plist
launchctl: missing the Label key: /Library/LaunchDaemons/
tomcat.plist ???
nothing found to load ???
sh-2.05b#
Sure that if I restart My Mac, will get nothig out of this...
Please help...
And thank you for all the answers I received.
Keep on the good work.
On 26 mars 07, at 04:01, Hassan Schroeder wrote:
> On 3/25/07, David Harrison <da...@stress-free.co.nz> wrote:
>
>> Either way works but Apple seems to promote the JAVA_HOME=/usr
>> alternative:
>
> Um, an article citing Tomcat *4.0.1* as "the latest"? OK....
>
> Let's just say: my startup script works, the OP's doesn't. You're more
> than welcome to adhere to the approach of your choice. :-)
>
> --
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Launching Tomcat at boot
Posted by Hassan Schroeder <ha...@gmail.com>.
On 3/25/07, David Harrison <da...@stress-free.co.nz> wrote:
> Either way works but Apple seems to promote the JAVA_HOME=/usr
> alternative:
Um, an article citing Tomcat *4.0.1* as "the latest"? OK....
Let's just say: my startup script works, the OP's doesn't. You're more
than welcome to adhere to the approach of your choice. :-)
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Launching Tomcat at boot
Posted by David Harrison <da...@stress-free.co.nz>.
On 26/03/2007, at 1:36 PM, Hassan Schroeder wrote:
> On 3/25/07, David Harrison <da...@stress-free.co.nz> wrote:
>
>> >> export JAVA_HOME=/usr
>
>> No the JAVA_HOME directive is correct for OSX.
>
> ??? The article shows this line in the example startup script
>
> export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
>
> and here's the JAVA_HOME variable from the PowerBook (OS X,
> 10.4.9) that I'm sending this from:
>
> /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0
>
> So /if it were me/ I'd change that line in the OP's script :-)
Either way works but Apple seems to promote the JAVA_HOME=/usr
alternative:
http://developer.apple.com/internet/java/tomcat1.html
David
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Launching Tomcat at boot
Posted by Hassan Schroeder <ha...@gmail.com>.
On 3/25/07, David Harrison <da...@stress-free.co.nz> wrote:
> >> export JAVA_HOME=/usr
> No the JAVA_HOME directive is correct for OSX.
>
> This article maybe worth reading, it covers setting Tomcat to load on
> boot in OSX.
> It appears to be written for 10.3 but the theory should hold true for
> 10.4:
??? The article shows this line in the example startup script
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
and here's the JAVA_HOME variable from the PowerBook (OS X,
10.4.9) that I'm sending this from:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0
So /if it were me/ I'd change that line in the OP's script :-)
YMMV,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Launching Tomcat at boot
Posted by Martin Gainty <mg...@hotmail.com>.
Good information!
Thanks David,
Martin--
---------------------------------------------------------------------------
This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited.
---------------------------------------------------------------------------
Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant) s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il est strictement interdit de le diffuser, de le distribuer ou de le reproduire.
----- Original Message -----
From: "David Harrison" <da...@stress-free.co.nz>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Sunday, March 25, 2007 9:04 PM
Subject: Re: Launching Tomcat at boot
> On 26/03/2007, at 10:30 AM, Hassan Schroeder wrote:
>
>> On 3/25/07, dimitryous r. <04...@edelphy.com> wrote:
>>
>>> My start_tomcat contain the following code:
>>
>>> export JAVA_HOME=/usr
>>
>> Well, right off the bat that line is useless :-) It needs to point
>> to your
>> installation of Java. Fix that and make sure the script starts Tomcat
>> when run from the command line first...
>
> No the JAVA_HOME directive is correct for OSX.
>
> This article maybe worth reading, it covers setting Tomcat to load on
> boot in OSX.
> It appears to be written for 10.3 but the theory should hold true for
> 10.4:
>
> http://www.macdevcenter.com/pub/a/mac/2002/06/18/tomcat.html?page=last
>
>
> David
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Launching Tomcat at boot
Posted by David Harrison <da...@stress-free.co.nz>.
On 26/03/2007, at 10:30 AM, Hassan Schroeder wrote:
> On 3/25/07, dimitryous r. <04...@edelphy.com> wrote:
>
>> My start_tomcat contain the following code:
>
>> export JAVA_HOME=/usr
>
> Well, right off the bat that line is useless :-) It needs to point
> to your
> installation of Java. Fix that and make sure the script starts Tomcat
> when run from the command line first...
No the JAVA_HOME directive is correct for OSX.
This article maybe worth reading, it covers setting Tomcat to load on
boot in OSX.
It appears to be written for 10.3 but the theory should hold true for
10.4:
http://www.macdevcenter.com/pub/a/mac/2002/06/18/tomcat.html?page=last
David
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Launching Tomcat at boot
Posted by Hassan Schroeder <ha...@gmail.com>.
On 3/25/07, dimitryous r. <04...@edelphy.com> wrote:
> My start_tomcat contain the following code:
> export JAVA_HOME=/usr
Well, right off the bat that line is useless :-) It needs to point to your
installation of Java. Fix that and make sure the script starts Tomcat
when run from the command line first...
HTH,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org