public function stop() { echo "stopping ...\n"; if ($this->isStopped()) { echo "not stopping. already.\n"; return true; } $length = strlen($this->getName()); foreach ($this->supervisor->getAllProcessInfo() as $i) { if ($this->getName() == substr($i['name'], 0, $length)) { $this->supervisor->stopProcess($this->getGroup(), $i['name']); sleep(1); // sleep while process ends } } return true; }