[Macosx]_[launchdaemons]_[mac OS X installation Tomcat boot service One of the methods]

Source: Internet
Author: User
Tags documentation java web

1. Hudson as a continuous integration software, it is necessary to deploy in a Java Web container to use, generally the most commonly used is tomcat.
2. It is easy for Tomcat to deploy installation Services on Windows, with the use of its own bat file to install successfully, and the trouble is that the documentation is not installed under Mac OS X.
3. Mac OS x is initiated using daemon and can also be understood as a service.
4. Typically execute startup.sh to start, and then add the startup file startup.sh to the login entry in the user and group, current user, but you must also set up automatic login. The disadvantage is: 1) unsafe, the server automatically log on. 2) This mode will pop up a command-line window, start more than a few times there will be a lot of windows to close themselves, affecting the use of other interface tools, so here is the use of services to start, the online information seems to be very small.
5. If it is just for installation, just look at the first part; in-depth understanding can be seen in the second part.

Part I: Installation Services
1. Installation Services, in fact, if configured plist, only need this step to add the start-up service.

sudo cp org.apache.tomcat.plist/library/launchdaemons/

Org.apache.tomcat.plist File Contents:

<?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">

Custom section:
This is modified to the full catalina.sh path/users/apple/desktop/apache-tomcat-5.5.25/bin/catalina.sh

This can only be an absolute path, not known on the command line using '/usr/libexec/java_home ' to get. Reference articles on the installation of Jdk1.7:


2. Test start-up service
Load the configuration file.

Launchctl load/library/launchdaemons/org.apache.tomcat.plistlaunchctl Start Org.apache.tomcat

3. After the start, you can open http://localhost:8080 see our familiar big face cat:

4. If you cannot open the Tomcat home page, turn on the output in the plist (set the path, remove the comment)

5. If the Test start service is successful, then restarting the computer should be self-booting.

Note: Each time you modify the plist file, you need to stop,remove (see below) Org.apache.tomcat load (see 2nd Step) This plist to take effect.

The second part: Manual testing Service, to start the service in the way of the command quickly, mainly write plist before the verification.

1. Quickly verify that the startup service is running successfully and does not need to replicate org.apache.tomcat.plist to/library/launchdaemons/, meaning to quickly verify that a program that needs to be deployed is running correctly. Of course the configuration should be the same as plist.

Launchctl submit-l org.apache.tomcat-o ' pwd '/stdout.log-e ' pwd '/stderr.log-p/users/apple/desktop/ Apache-tomcat-5.5.25/bin/catalina.sh Run

2. Stop the Service

Launchctl Stop Org.apache.tomcat

3. Remove the service from the current job

Launchctl Remove Org.apache.tomcat

4. Warning Error launchctl run Error:file exists

Indicates that the job has been started and needs to be stopped and removed before it can be rerun.

Launchctl Stop Org.apache.tomcatlaunchctl Remove Org.apache.tomcat

5. The configured output hint error indicates that the JAVA_HOME environment variable is not configured.

Neither the Java_home nor the jre_home environment variable is definedat least one of these environment variable is needed To run the This program

6. Setting Environment variables

Launchctl setenv java_home '/usr/libexec/java_home '

7. Delete environment variables

Launchctl unsetenv Java_home

Reference Documentation:
Https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/launchctl.1.html#//apple_ Ref/doc/man/1/launchctl

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

[Macosx]_[launchdaemons]_[mac OS X installation Tomcat boot service One of the methods]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.