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 09:22:23 UTC

Re: Launching Tomcat at boot, at boot, at boot

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 = 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