24 |
function check_online($dat, $bla) |
function check_online($dat, $bla) |
25 |
{ |
{ |
26 |
global $comps; |
global $comps; |
27 |
|
global $pingcmd; |
28 |
|
|
29 |
if(!isset($comps[$dat['serial']])) return false; |
if(!isset($comps[$dat['serial']])) return false; |
30 |
|
|
31 |
//passthru("/bin/ping -I eth0 -c 1 -W 1 -q ".$dat['ip']." &> /dev/null && exit 0 || exit 1",$retval); |
passthru($pingcmd." ".$dat['ip']." &> /dev/null && exit 0 || exit 1",$retval); |
|
passthru("/usr/sbin/fping -c 1 -t 50 -q ".$dat['ip']." &> /dev/null && exit 0 || exit 1",$retval); |
|
32 |
if($retval==0) |
if($retval==0) |
33 |
{ |
{ |
34 |
$comps[$dat['serial']]['online'] = true; |
$comps[$dat['serial']]['online'] = true; |
129 |
{ |
{ |
130 |
$pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$c['serial'].''); |
$pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$c['serial'].''); |
131 |
while ($row = mysql_fetch_row ($pubkey)) { |
while ($row = mysql_fetch_row ($pubkey)) { |
|
$sshcmd = "/usr/bin/ssh"; |
|
|
$home = "/home/httpd"; |
|
|
|
|
132 |
# schreiben der .ssh/known_hosts file mit dem public rsa key des client, |
# schreiben der .ssh/known_hosts file mit dem public rsa key des client, |
133 |
# um die "yes" abfrage zu vermeiden |
# um die "yes" abfrage zu vermeiden |
134 |
$hostfile = fopen ($home."/.ssh/known_hosts","w"); |
$hostfile = fopen ($home."/.ssh/known_hosts","w"); |
135 |
fwrite($hostfile,$c['ip']." ".$row[0],strlen($row[0])+strlen($c['ip'])+1); |
fwrite($hostfile,$c['ip']." ".$row[0],strlen($row[0])+strlen($c['ip'])+1); |
136 |
fclose($hostfile); |
fclose($hostfile); |
137 |
|
|
138 |
$osver = exec($sshcmd.' -l root '.$c['ip'].' \'os_ver=$(</etc/mageversion);cfg_ver=$(/sbin/magequery -n alxconfig-ng-alx|cut -d" " -f5);pname=${cfg_ver%-*-*};cfg_ver=${cfg_ver/${pname}-};echo "${os_ver}:${cfg_ver}"\''); |
$osver = exec($sshcmd.' -l root '.$c['ip'].' \'os_ver=$(<'.$mageversion.');cfg_ver=$(/sbin/magequery -n '.$alxconfig.'|cut -d" " -f5);pname=${cfg_ver%-*-*};cfg_ver=${cfg_ver/${pname}-};echo "${os_ver}:${cfg_ver}"\''); |
139 |
$osver = explode(':',$osver); |
$osver = explode(':',$osver); |
140 |
} |
} |
141 |
if($osver[0] == '') $osver[0]='unkown'; |
if($osver[0] == '') $osver[0]='unkown'; |