Magellan Linux

Diff of /alx-src/trunk/alx-web/reboot.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 355 by niro, Mon Oct 10 19:42:06 2005 UTC revision 424 by niro, Wed Jun 4 21:54:04 2008 UTC
# Line 8  Line 8 
8   *   *
9   * that's it, works4me (TM)   * that's it, works4me (TM)
10   */   */
11     include('include/config.inc.php');
12  // $client = '16';   include('include/dbconn.php');
 // $ip = '128.20.40.61';  
 // $op = 'reboot';  
13    
14   echo '<body onload="window.setTimeout(\'window.close()\', 1750)">';   echo '<body onload="window.setTimeout(\'window.close()\', 1750)">';
15   echo '<table width=100% height=100% style="border:solid black 1px; background-color:#d5e5ff"><tr><td valign=middle align=center>';   echo '<table width=100% height=100% style="border:solid black 1px; background-color:#d5e5ff"><tr><td valign=middle align=center>';
  include('include/dbconn.php');  
16    
17   $pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$client.'');   $pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$client.'');
18   while ($row = mysql_fetch_row ($pubkey)) {   while ($row = mysql_fetch_row ($pubkey)) {
 // echo 'Client Public RSA-Key:<br>';  
 // echo $row[0].'<br>';  
19    
20   # 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,
21   # um die "yes" abfrage zu vermeiden   # um die "yes" abfrage zu vermeiden
22   $hostfile = fopen ("/home/www-data/.ssh/known_hosts","w");   $hostfile = fopen ($home."/.ssh/known_hosts","w");
23   fwrite($hostfile,$ip." ".$row[0],strlen($row[0])+strlen($ip)+1);   fwrite($hostfile,$ip." ".$row[0],strlen($row[0])+strlen($ip)+1);
24   fclose($hostfile);   fclose($hostfile);
25    
26   # reboot des clients   # reboot des clients
27  // passthru('/bin/ping -I eth0 -c 1 -W 1 -q '.$ip.' &> /dev/null && exit 0 || exit 1',$retval);   passthru($pingcmd.' '.$ip.' &> /dev/null && exit 0 || exit 1',$retval);
  passthru('/usr/sbin/fping -c 1 -t 50 -q '.$ip.' &> /dev/null && exit 0 || exit 1',$retval);  
28   if($retval==0) {   if($retval==0) {
29   echo '<img src="pics/online.gif" align=top> '.strtoupper($op.'ing client #'.$client.' ('.$ip.')...<br>');   echo '<img src="pics/online.gif" align=top> '.strtoupper($op.'ing client #'.$client.' ('.$ip.')...<br>');
30   system('/usr/bin/ssh -l root '.$ip.' /sbin/'.$op);   system($sshcmd.' -l root '.$ip.' /sbin/'.$op);
31   }   }
32   else echo '<img src="pics/offline.gif" align=top> '.strtoupper('Client not online, try again later...<br>');   else echo '<img src="pics/offline.gif" align=top> '.strtoupper('Client not online, try again later...<br>');
33   }   }

Legend:
Removed from v.355  
changed lines
  Added in v.424