How to create a launchd item to start Tomcat App Server?

Discussion in 'macOS' started by Mork, Jan 12, 2009.

  1. Mork macrumors 6502

    Joined:
    Jan 9, 2009
    #1
    I bought a couple of the Mac OS X books written by David Pogue. These books are fine as far as they go, but don't go into the details, in some cases, that I need.

    My current issue is that I want to be able to start the Tomcat Application server's "startup.sh" script file when OS X starts. From reading David's books, I think I need to create a launchd script. However, it's difficult to find any good references on how to do this or other Unix type books written for OS X.

    So, my questions are these:

    1. Is there a good editor or reference to create a startup.sh item that will start automatically (for the Tomcat app server) when OS X starts?

    2. Is there a good OS X book that isn't about how to start iTunes and other "stuff" like this I'll never use, but, instead, talks about more technical issues?

    I mean, I don't need to read about the OS' preemptive multitasking algorithms (though this would no doubt be interesting), but something with more Unix and OS X's internals would be good.

    Thanks in advance for any replies.

    M
     
  2. rsullins macrumors newbie

    Joined:
    Jun 1, 2009
    #2
    Launching tomcat

    I have been attempting to do the same thing.

    I have read the instructions on the internet at

    http://wiki.apache.org/tomcat/TomcatOnMacOS

    I am close to getting it to work but I need some help.
    I am able to get apache started but tomcat does not get started automatically.

    Where do I go to view a startup log. Is the console the best place? Are there some resources to describe system startup scripts?
     
  3. Mork thread starter macrumors 6502

    Joined:
    Jan 9, 2009
    #3
    It's funny that this feature, launchd, isn't documented and well understood. I've been amazed by the lack of response and understanding on some seemingly standard useful O/S capabilities.

    Since there was never a reply, and I couldn't find any documentation, I just gave up and start Tomcat manually using the

    ./startup.sh

    Thanks for your reply.
     
  4. Mork thread starter macrumors 6502

    Joined:
    Jan 9, 2009
    #5
    Hey,

    Yeah, I found the same thing too.

    The problem turns out to be getting launchd to work correctly and to understand how it really works (from an initial "tutorial" perspective).

    Tomcat runs fine on the Mac.

    Thanks.
     
  5. kamochan macrumors newbie

    Joined:
    Feb 20, 2009
    #6
    Some things to perhaps consider:

    - in OSX Server, Tomcat is installed in /Library/Tomcat

    - all files are owned by user _appserver

    - webapps belongs to _appserverusr group, group writable

    - other directories belong to _appserveradm group, also group writable

    - the launchd script runs a simple shell script wrapper around startup.sh because launchd requires a non-daemonizing program to run

    - the launchd plist is simple, just follow Apple's launchd documentation

    If you follow these guidelines, then your Tomcat installation will conform better to what Apple ships with its server product, and is likely to behave reasonably well.
     
  6. Mork thread starter macrumors 6502

    Joined:
    Jan 9, 2009
    #7
    Where exactly is Apple's launchd documentation?

    That would be quite helpful to know.

    Thank you in advance!
     

Share This Page