Install As System Service

Version 5 by Robin Shen
on Sep 04, 2011 10:50.


compared with
Current by Robin Shen
on Feb 19, 2013 07:59.


 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 6 changes. View first change.

 This document explains how to configure QuickBuild server to run as system service. The process for build agent and user agent is the same except that you need to replace occurrance of _server.(bat|sh)_ with _agent.(bat|sh)_.
 {note}If you have multiple build agents installed on the same machine, you will need to run _<agent install dir>/bin/config.(bat|sh)_ to configure different service name for different build agent.
 {note}
  This document explains how to configure QuickBuild programs (server, build agent, and user agent) to run as system service.
  
 
 h3. On Windows Platform
# Open a command prompt window and switch to folder _bin_ under QuickBuild' installation directory. On Windows Vista and Windows 7 system with UAC enabled, you will need to [open the command prompt window as Administrator|http://www.howtogeek.com/howto/windows-vista/run-a-command-as-administrator-from-the-windows-vista-run-box/].
 # Run command _server.bat install_ from the command prompt window, and a Windows service with the name _QuickBuild Server_ will be installed.
 # You may need to configure the service to run as a different user if necessary (normally when the SCM can not be accessed by the default system account).
 # If you want to uninstall the installed service later, just run command _/server.bat remove_ in the command prompt window (make sure the command prompt window is [opened with administrative right|http://www.howtogeek.com/howto/windows-vista/run-a-command-as-administrator-from-the-windows-vista-run-box/] on Windows Vista and Windows 7 system with UAC enabled).
  
 h3. On Mac OS X
 From Mac OS X v10.4 Tiger, Apple introduced a new system startup program called [launchd|http://developer.apple.com/MacOsX/launchd.html]. QuickBuild server can be installed as a service by creating a configuration file _quickbuild.server.plist_ in direcory _/Library/LaunchDaemons_, below is a skeleton for it:
  # If necessary, edit file _<QuickBuild server (or agent) install dir>/conf/wrapper.conf_ to specify service account via below properties:
 {code}
<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
  <key>Label</key>
  <string>com.pmease.quickbuild</string>
  <key>ProgramArguments</key>
  <array>
  <string>/path/to/quickbuild_install_dir/bin/server.sh</string>
  <string>start</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
 </dict>
 </plist>
  wrapper.ntservice.account=
 wrapper.ntservice.password=
 {code}
To run QuickBuild server as a specified user, you may add below property to file _quickbuild.server.plist_:
 {code}
 <key>UserName</key>
 <string>my_user_name</string>
 {code}
 {warning}Please make sure the user name you specified here have the full access rights to QuickBuild installation directory.{warning}
  The service will run under local system account if these properties are not specified.
 # If necessary, edit above file to specify desired display name and description of the service via property _wrapper.displayname_ and _wrapper.description_.
 {note}
 Make sure to modify these properties to use different service name and description if you want to install multiple QuickBuild servers or agents in the same machine.
 {note}
 # Open a command prompt window and switch to folder _<QuickBuild server (or agent) install dir>/bin_. On Windows system with UAC enabled, you will need to [open the command prompt window as Administrator|http://www.howtogeek.com/howto/windows-vista/run-a-command-as-administrator-from-the-windows-vista-run-box/].
 # Run command _server.bat install_ (or _agent.bat install_) from command prompt window, and a Windows service with the name _QuickBuild Server_ will be installed.
 # If you want to uninstall the service later, just run command _server.bat remove_ (or _agent.bat remove_) in the command prompt window (make sure the command prompt window is [opened with administrative right|http://www.howtogeek.com/howto/windows-vista/run-a-command-as-administrator-from-the-windows-vista-run-box/] on Windows system with UAC enabled).
  
 For more information on launchd, please read below reference:
 * [Creating launchd Daemons and Agents|http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/LaunchOnDemandDaemons.html]
 * [launchd manual|http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/launchd.8.html]
 * [launchd.plist|http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html]
  
 h3. On Other Unix Platforms
  
 The command _server.sh start_ can be used to start the server as background process, and _server.sh stop_ can be used to stop that process. This process also accepts TERM signal to shutdown itself gracefully. You can safely put the start up command into system start up script so that QuickBuild server starts automatically when system reboots.
 {warning}Please make sure the user starting QuickBuild server have the full access rights to QuickBuild installation directory.{warning}
  h3. On Unix family Platforms (including MacOS X and Linux)
 # Open a command shell and switch to folder _<QuickBuild server (or agent) install dir>/bin_.
 # Edit file _server.sh_ (or _agent.sh_) to uncomment below line to specify the OS user to run the service as. Make sure the user has full permission against QuickBuild installation directory including all sub directories and files.
 {code}#RUN_AS_USER={code}
 The service will be run under root account if this line is commented out.
 # If necessary, edit above file to specify desired display name and description of the service via property _APP_NAME_ and _APP_LONG_NAME_.
 {note}
 Make sure to modify these properties to use different service name and description if you want to install multiple QuickBuild servers or agents in the same machine.
 {note}
 # Run command _server.sh install_ (or _agent.sh install_) to install the service.
 # If you want to uninstall the service later, just run command _server.sh remove_ (or _agent.sh remove_) in the command shell.