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