| 113 | | return false; |
|---|
| 114 | | } else { |
|---|
| 115 | | $this->lock = fopen($this->lock_file, 'x+'); |
|---|
| 116 | | } |
|---|
| | 112 | //get pid that set the lock and ensure its still running |
|---|
| | 113 | $pid = file_get_contents($this->lock_file); |
|---|
| | 114 | |
|---|
| | 115 | exec(fpbx_which('ps') . ' h ' . $pid, $ret, $status); |
|---|
| | 116 | //exit code ($status) will be 0 if running, or 1 if pid not found |
|---|
| | 117 | if ($status === 0) { |
|---|
| | 118 | return false; |
|---|
| | 119 | } else { |
|---|
| | 120 | //if we dont see the prosses running, remove the lock |
|---|
| | 121 | unlink($this->lock_file); |
|---|
| | 122 | } |
|---|
| | 123 | } |
|---|
| | 124 | |
|---|
| | 125 | $this->lock = fopen($this->lock_file, 'x+'); |
|---|
| | 126 | |
|---|