How to install Hudson as a service on OS X?

后端 未结 3 1508
無奈伤痛
無奈伤痛 2020-12-25 08:24

Running hudson it is easy but currently the documentation is missing the tutorial for installing an running hudson as a daemon/service on OS X.

When you switch to p

3条回答
  •  半阙折子戏
    2020-12-25 09:07

    If you want a local Hudson to run on your Mac whenever you log in, try this.

    You'll want to set up a launchctl plist for it; that should look something like this:

    
    
    
    
     UserName
     yourid
     Label
     Hudson
     EnvironmentVariables
       
         HUDSON_HOME
         /Users/yourid/.hudson
       
     ProgramArguments
     
     /usr/bin/java
     -jar
     /Users/yourid/Hudson/hudson.war
     
     RunAtLoad
     
    
    
    

    This assumes you've downloaded hudson.war to your home directory under ~/Hudson, and that you want to run it as yourself (probably the best decisions.) Be sure that you define the key or it will run as root!

    Starting on login

    1. Save the above as /Library/LaunchAgents/hudson.plist
    2. Start it the first time with

      sudo launchctl load -w /Library/LaunchAgents/hudson.plist

    or log out and back in, which will do the same thing automatically.

    Starting on reboot

    1. Save the above as /Library/LaunchDaemons/hudson.plist
    2. Start it the first time with

      sudo launchctl load -w /Library/LaunchDaemons/hudson.plist

    or reboot your machine, which will do the same thing automatically.

    Restarting Hudson

    Hudson can't automatically restart under OS X, so if you need to stop it, issue the restart command

    launchctl unload -w path_to_plist
    

    I have found that sometimes it doesn't stop on the first execution of launchctl unload; in those cases just issue the command again.

    This will run under port 8080 as if you had run the command from the command line yourself, using the Winstone server built in to the .war file.

    I realize this doesn't specifically answer the "run it on port 80" question, but for development on your own laptop, I suggest that this is a better option.

提交回复
热议问题