def start_couchdb(self):
        """
        @brief Start the instrument agent
        """
        # Do nothing if rabbit is already running
        log.debug("****************************STARTING COUCHDB****************************")
        pid = self._read_pidfile(self._pid_filename("couchdb"))
        if pid:
            return

        cmd = Config().get("couchdb")
        if not cmd:
            raise MissingConfig("couchdb")

        self._run_process(cmd, '-b', self._pid_filename("couchdb"), False)
    def stop_couchdb(self):
        """
        @brief Stop the instrument agent
        """
        log.info("Stopping CouchDB")
        pid = self._read_pidfile(self._pid_filename("couchdb"))

        if not pid > 0:
            return

        cmd = Config().get("couchdb")
        if not cmd:
            raise MissingConfig("couchdb")

        self._run_process(cmd, '-k')

        os.remove(self._pid_filename("couchdb"))
        time.sleep(2)  # couch requires some refractory time
    def start_rabbitmq_server(self):
        """
        @brief Start the instrument agent
        """
        # Do nothing if rabbit is already running
        pid = self._read_pidfile(self._pid_filename("rabbitmq"))
        if pid:
            return

        cmd = Config().get("rabbitmq")
        if not cmd:
            raise MissingConfig("rabbitmq")

        # The rabbit startup file is a script that starts the erl program.  If
        # erl isn't in the path the server doesn't start.
        # TODO: put this in a config parameter
        os.environ['PATH'] = "%s:%s" % (os.environ['PATH'], "/usr/local/bin")
        self._run_process(cmd, '-detached', self._pid_filename("rabbitmq"), False)