Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function running() |
||
31 | { |
||
32 | $cli = $this->cli; |
||
33 | $cli->shoutBold(__METHOD__); |
||
34 | |||
35 | // use process id for log notifications |
||
36 | $mypid = getmypid(); |
||
37 | $pid = $mypid['PID']; |
||
38 | $msg = $pid . ': Starting...'; |
||
39 | $cli->shout($msg); |
||
40 | |||
41 | // check if already running, quit if so |
||
42 | exec('ps auxww | grep -i index/running | grep -v grep', $output); |
||
43 | |||
44 | if (1 < count($output)) { |
||
45 | $msg = $pid . ': Already running! Quitting.'; |
||
46 | $cli->shout($msg); |
||
47 | return false; |
||
48 | } |
||
49 | |||
50 | sleep(10); |
||
51 | } |
||
52 | } |
||
53 |