function _gs_siemens_prov_phone_checkcfg_by_ip_do_siemens($ip, $reboot = true, $pre_sleep = 0) { if (_gs_prov_phone_checkcfg_exclude_ip($ip)) { return; } $cmd = 'wget -q -O /dev/null -o /dev/null -b --tries=1' . ' --timeout=10 --retry-connrefused --no-http-keep-alive' . ' --user-agent=' . escapeShellArg('Jakarta Commons-HttpClient/3.0') . ' --header=' . escapeShellArg('Content-type: application/x-www-form-urlencoded; charset=utf-8') . ' --post-data=' . escapeShellArg('ContactMe=true') . ' ' . escapeShellArg('http://' . $ip . ':8085/contact_dls.html/ContactDLS'); # Sometimes the phone just ignores the ContactMe request so we need # to send this twice to be sure. But then again 2 requests within 1 # second would cause the phone's web server to die. # So don't just do for ($i=0; $i<2; ++$i) @exec($cmd, $out, $err); # Edit: Retrying more than once a minute or so is very likely to # crash the phone. /* FIXME: does not work via SSH if (! gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) { $listen_to_ids = gs_get_listen_to_ids(); if (is_array($listen_to_ids) && count($listen_to_ids)>0) { $cmd = 'ssh -o StrictHostKeyChecking=no -o BatchMode=yes -l root '. qsa( GS_PROV_HOST ) .' '. qsa($cmd); } unset($listen_to_ids); } */ $ign_out = '1>>/dev/null 2>>/dev/null'; if ($pre_sleep < 1) { @exec($cmd, $out, $err); } else { $s = (int) $pre_sleep; @exec('(sleep ' . $s . '; ' . $cmd . ') ' . $ign_out . ' &', $out, $err); } }
function _gs_prov_phone_checkcfg_by_ip_do_tiptel($ip, $reboot = true) { if (_gs_prov_phone_checkcfg_exclude_ip($ip)) { return; } @exec('/opt/gemeinschaft/sbin/gs-tiptel-reboot --ip=' . qsa($ip) . ' >>/dev/null 2>>/dev/null &', $out, $err); }