Starting and Stopping the Maestro Project Server

The next few sections discuss starting and stopping the Maestro Project Server.

Starting Maestro Project Server

Starting Maestro on a Windows system

To start Maestro, execute the following in a command window:

[maestro_home]/projectserver/bin/maestro.bat console

Adding Maestro as a service after installation on a Windows system

If you want to add Maestro as a service in Windows, execute:

[maestro_home]/projectserver/bin/maestro.bat install

Note: This can be done before or after Maestro is running.

Once Maestro is installed as a service and its Startup Type is Manual, you can start the Maestro Project Server service by typing:

[maestro_home]/projectserver/bin/maestro.bat start

By default, the Startup Type of the installed service is Automatic. You can change this by following the steps below:

  1. Go to the Windows Control Panel > Administrative Tools > Services.
  2. Right-click on the Maestro Project Server service.
  3. Select Properties and change its start-up type in the Properties dialog to the desired value.
  4. Click OK.

Also by default, a service runs with the system user that doesn't have a home directory. If you want to use your own settings.xml and run the service with your user, you need to configure the service with your user. To do this:

  1. Go to the Windows Control Panel > Administrative Tools > Services.
  2. Stop the Maestro Project Server service if it is running.
  3. Right click on the Maestro Project Server service.
  4. Select Properties and go the the Log On tab.
  5. Under the Log on as section, select This account option and specify the username. Provide the password if there's any.
  6. Click Apply and/or OK.
  7. Restart the Maestro Project Server service.

Starting Maestro on a Linux/UNIX system

The Maestro startup script is found in [maestro_home]/projectserver/bin/. To start Maestro, you may execute any of the following steps:

  • In a command console, execute ./[maestro_home]/projectserver/bin/maestro start to run it as a daemon process.
  • Or, execute ./[maestro_home]/projectserver/bin/maestro console in a command console to run it in console mode.
Startup script options for UNIX

The maestro script for UNIX systems (Linux, Solaris, and Mac OS) have the following options in addition to the start and stop options discussed in the above sections.

  • start - This option will start Maestro as a daemon process. Specifically, it runs the executable wrapper of the Maestro application.
  • stop - This option will stop the Maestro daemon process.
  • restart - This option will stop and then start Maestro again.
  • console - This option will start Maestro and display the log to the console. This is very useful for debugging. To terminate this, just hit Ctrl-C.
  • status - This option will display whether Maestro is running or not.
  • dump - This option will dump a stack trace for each thread.
Error conditions during UNIX startup

If you start Maestro on a UNIX system and it starts, but immediately shuts itself down make sure your UNIX hostname is configured properly. Then start Maestro again.

Installing Maestro as a service in Linux

To install Maestro as a Linux service, just follow the steps below. Take note that you need to execute them as root.

Basic script in /etc/init.d

Create a maestro file under /etc/init.d/ with the following content. Replace maestro_user with the name of an account that you have already created. In the script below, the Maestro binaries were unpacked in /opt.

  #!/bin/sh

  MAESTRO_HOME=/opt/maestro-2.3.1
  su - maestro_user -c "$MAESTRO_HOME/projectserver/bin/maestro console $@ &"
On a Debian-based System
  ln -s /usr/local/maestro-[VERSION]/projectserver/bin/maestro /etc/init.d/maestro

In the above command, the Maestro binaries were assumed to be unpacked at /usr/local. At this point, Maestro is ready to be symlinked from different runlevels. To create these links, just run this as root:

  update-rc.d -n maestro defaults 80  

After running this command, you will something similar to this:

  Adding system startup for /etc/init.d/maestro ...
   /etc/rc0.d/K80maestro -> ../init.d/maestro
   /etc/rc1.d/K80maestro -> ../init.d/maestro
   /etc/rc6.d/K80maestro -> ../init.d/maestro
   /etc/rc2.d/S80maestro -> ../init.d/maestro
   /etc/rc3.d/S80maestro -> ../init.d/maestro
   /etc/rc4.d/S80maestro -> ../init.d/maestro
   /etc/rc5.d/S80maestro -> ../init.d/maestro

These are the symlinks that would be created. The above command didn't actually create anything because of the -n switch. Remove that switch and run the command again to have the actual links created.

On a Red Hat-based System

Configuring Maestro on a RedHat-based system (like Fedora Core) is a bit different from the above. Instead of running update-rc.d, you need to add a new service using the chkconfig command. In order to add Maestro using this command, you would need to add some comments to the /etc/rc.d/init.d/maestro script and run a number of commands. These tasks are executed by running the chkconfig_install.sh script below. Take note that maestro_user needs to be replaced by the name of an account you have already created.

  #! /bin/sh

  # figure out Maestro's directory
  MAESTRO_HOME=`dirname $0`
  cd ${MAESTRO_HOME}
  MAESTRO_HOME=`pwd`

  INITD_SCRIPT=/etc/rc.d/init.d/maestro

  if [ -f ${INITD_SCRIPT} ]
  then
    echo "File ${INITD_SCRIPT} already exists. Please remove it and try again."
    exit 1
  fi

  echo "Creating file ${INITD_SCRIPT}"
  cat >> ${INITD_SCRIPT} <<EOF
  #! /bin/sh
  # chkconfig: 345 90 10
  # description: Maestro server

  # uncoment to set JAVA_HOME as the value present when Maestro is installed
  #export JAVA_HOME=${JAVA_HOME}

  if [ -z "\${JAVA_HOME}" ]
  then
    echo "Cannot manage Maestro without variable JAVA_HOME set"
    echo "  (try to set it on file ${INITD_SCRIPT})"
    exit 1
  fi
  # run Maestro as root
  cd ${MAESTRO_HOME}
  ./bin/maestro \$*
  # run Maestro as user _maestro_user_
  #su - _maestro_user_ -c "cd ${MAESTRO_HOME}; ./bin/maestro \$*"
  EOF
  chmod +x ${INITD_SCRIPT}

  echo "Adding Maestro to chkconfig"
  chkconfig --add maestro

  echo "Enabling Maestro on chkconfig"
  chkconfig maestro on
  echo "Maestro set to start on run levels 3, 4 and 5."
  echo "To start Maestro now, run 'service maestro start'"

Installing Maestro as a service in MacOSX

To install Maestro as a service in MacOSX, just add the snippet below to /Library/LaunchDaemons/com.maestrodev.maestro.plist, where the value /Applications/Maestro/maestro-2.3.1/projectserver/bin/maestro below is the path to the Maestro startup script. Make sure that you are pointing to the correct location.

  <!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>Label</key>
      <string>com.maestrodev.maestro</string>
      <key>OnDemand</key>
      <false/>
      <key>ProgramArguments</key>
      <array>
        <string>/Applications/Maestro/maestro-2.3.1/projectserver/bin/maestro</string>
        <string>console</string>
      </array>
      <key>RunAtLoad</key>
      <true/>
      <key>ServiceDescription</key>
      <string>Maestro Project Server</string>
    </dict>
  </plist>

Stopping Maestro Project Server

Stopping Maestro on a Windows system

If you manually installed the binary distribution of Maestro, added it as a Windows service and it is currently running in the background, you can stop it from the Windows Control Panel > Administrative Tools > Services. Choose the Maestro Project Server service and click Stop. Or you can open a console and execute:

[maestro_home]/projectserver/bin/maestro.bat stop

If you started the Maestro Project Server by executing [maestro_home]/projectserver/bin/maestro.bat console:

On Windows command line: press Ctrl+C to stop the process, and then answer "y" to the "Terminate batch job (Y/N)" question.

Note: Whether you answer Y or N, Maestro will terminate.

Stopping Maestro on a UNIX system

To stop Maestro Project Server service on UNIX type:

./[maestro_home]/projectserver/bin/maestro stop

where [maestro_home] is the directory in which Maestro was installed.

If you started the Maestro Project Server by executing ./[maestro_home]/projectserver/bin/maestro console, press Ctrl+C to stop the process.