protected static Status createStatus(
     final String basename, final int state, final int pid, final String msg, final Throwable t) {
   final Status status = new Status(basename);
   status.state = state;
   status.pid = pid;
   status.msg = msg;
   status.exception = t;
   return status;
 }
  /** Starts the GemFire JMX Agent "server" process with the given command line arguments. */
  public void server(final String[] args) throws Exception {
    final Map<String, Object> options = getServerOptions(args);

    // make the process a UNIX daemon if possible
    String errMsg = makeDaemon();

    workingDirectory = IOUtils.tryGetCanonicalFileElseGetAbsoluteFile((File) options.get(DIR));

    Status status = createStatus(this.basename, STARTING, OSProcess.getId());
    status.msg = errMsg;
    writeStatus(status);

    Agent agent = startAgentVM((Properties) options.get(AGENT_PROPS), status);

    // periodically check and see if the JMX Agent has been told to stop
    pollAgentForPendingShutdown(agent);
  }