Datadog agent fails to restart on freebsd with the error below if the agent is already stopped: # service datadog-agent restart Error: Error stopping the agent: Post "https://localhost:5001/agent/stop": dial tcp [::1]:5001: connect: operation timed out Current workaround that seems to fix the problem is adding a check and a sleep in the stop or restart in rc.d of datadogagent Below is a snip of current datadogagent rc.d datadog_agent_restart() { datadog_agent_stop && sleep 3 && datadog_agent_start return $? } datadog_agent_stop() { rc_pid=`check_pidfile ${pidfile} ${command}` if [ -n "${rc_pid}" ]; then ${command} ${command_args} stop fi return $? }