| Conditions | 4 |
| Paths | 6 |
| Total Lines | 20 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public function reStart(): void |
||
| 26 | { |
||
| 27 | $config = $this->getDI()->get('config')->beanstalk; |
||
| 28 | |||
| 29 | $beanstalkdPath = Util::which('beanstalkd'); |
||
| 30 | $conf = "-l {$config->host} -p {$config->port} -z 524280"; |
||
| 31 | if (Util::isSystemctl()) { |
||
| 32 | $systemCtrlPath = Util::which('systemctl'); |
||
| 33 | Processes::mwExec("{$systemCtrlPath} restart beanstalkd.service"); |
||
| 34 | } else { |
||
| 35 | Processes::killByName('beanstalkd'); |
||
| 36 | Processes::mwExecBg("{$beanstalkdPath} {$conf}"); |
||
| 37 | } |
||
| 38 | while (true) { |
||
| 39 | $pid = Processes::getPidOfProcess('beanstalkd'); |
||
| 40 | if (empty($pid)) { |
||
| 41 | Util::echoWithSyslog(' - Wait for start beanstalkd deamon ...' . PHP_EOL); |
||
| 42 | sleep(2); |
||
| 43 | } else { |
||
| 44 | break; |
||
| 45 | } |
||
| 48 | } |