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