Revision 1015b3a9
Added by Warren Baker about 14 years ago
etc/inc/util.inc | ||
---|---|---|
139 | 139 |
function send_event($cmd) { |
140 | 140 |
global $g; |
141 | 141 |
|
142 |
if(!isset($g['event_address'])) |
|
143 |
$g['event_address'] = "unix:///var/run/check_reload_status"; |
|
144 |
|
|
142 | 145 |
$try = 0; |
143 | 146 |
while ($try < 3) { |
144 | 147 |
$fd = @fsockopen($g['event_address']); |
... | ... | |
156 | 159 |
} |
157 | 160 |
|
158 | 161 |
function send_multiple_events($cmds) { |
159 |
global $g;
|
|
162 |
global $g;
|
|
160 | 163 |
|
164 |
if(!isset($g['event_address'])) |
|
165 |
$g['event_address'] = "unix:///var/run/check_reload_status"; |
|
166 |
|
|
161 | 167 |
if (!is_array($cmds)) |
162 | 168 |
return; |
163 |
$fd = fsockopen($g['event_address']);
|
|
164 |
if ($fd) {
|
|
169 |
$fd = fsockopen($g['event_address']);
|
|
170 |
if ($fd) {
|
|
165 | 171 |
foreach ($cmds as $cmd) { |
166 |
fwrite($fd, $cmd);
|
|
167 |
$resp = fread($fd, 4096);
|
|
168 |
if ($resp != "OK\n")
|
|
169 |
log_error("send_event: sent {$cmd} got {$resp}");
|
|
172 |
fwrite($fd, $cmd);
|
|
173 |
$resp = fread($fd, 4096);
|
|
174 |
if ($resp != "OK\n")
|
|
175 |
log_error("send_event: sent {$cmd} got {$resp}");
|
|
170 | 176 |
} |
171 |
fclose($fd);
|
|
172 |
}
|
|
177 |
fclose($fd);
|
|
178 |
}
|
|
173 | 179 |
} |
174 | 180 |
|
175 | 181 |
function refcount_init($reference) { |
Also available in: Unified diff
If no event_address in globals.inc specified assume the default. Also fixed whitespaces.