| @@ 200-222 (lines=23) @@ | ||
| 197 | * @param int $pid |
|
| 198 | * @return bool |
|
| 199 | */ |
|
| 200 | public function getPidIsRunning($pid) |
|
| 201 | { |
|
| 202 | // what are we doing? |
|
| 203 | $log = Log::usingLog()->startAction("is process PID '{$pid}' running on host '{$this->args[0]}'?"); |
|
| 204 | ||
| 205 | // make sure we have valid host details |
|
| 206 | $hostDetails = $this->getHostDetails(); |
|
| 207 | ||
| 208 | // get an object to talk to this host |
|
| 209 | $host = OsLib::getHostAdapter($this->st, $hostDetails->osName); |
|
| 210 | ||
| 211 | // get the information |
|
| 212 | $return = $host->getPidIsRunning($hostDetails, $pid); |
|
| 213 | ||
| 214 | // did it work? |
|
| 215 | if ($return) { |
|
| 216 | $log->endAction("'{$pid}' is running"); |
|
| 217 | return true; |
|
| 218 | } |
|
| 219 | ||
| 220 | $log->endAction("'{$pid}' is not running"); |
|
| 221 | return false; |
|
| 222 | } |
|
| 223 | ||
| 224 | /** |
|
| 225 | * @param string $processName |
|
| @@ 228-250 (lines=23) @@ | ||
| 225 | * @param string $processName |
|
| 226 | * @return bool |
|
| 227 | */ |
|
| 228 | public function getProcessIsRunning($processName) |
|
| 229 | { |
|
| 230 | // what are we doing? |
|
| 231 | $log = Log::usingLog()->startAction("is process '{$processName}' running on host '{$this->args[0]}'?"); |
|
| 232 | ||
| 233 | // make sure we have valid host details |
|
| 234 | $hostDetails = $this->getHostDetails(); |
|
| 235 | ||
| 236 | // get an object to talk to this host |
|
| 237 | $host = OsLib::getHostAdapter($this->st, $hostDetails->osName); |
|
| 238 | ||
| 239 | // get the information |
|
| 240 | $return = $host->getProcessIsRunning($hostDetails, $processName); |
|
| 241 | ||
| 242 | // did it work? |
|
| 243 | if ($return) { |
|
| 244 | $log->endAction("'{$processName}' is running"); |
|
| 245 | return true; |
|
| 246 | } |
|
| 247 | ||
| 248 | $log->endAction("'{$processName}' is not running"); |
|
| 249 | return false; |
|
| 250 | } |
|
| 251 | ||
| 252 | /** |
|
| 253 | * @param string $processName |
|