add RUNNING_PID logic, borrowed from playframework