Magellan Linux

Contents of /alx-src/branches/alx-web-050/reboot.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1600 - (show annotations) (download)
Thu Dec 2 19:56:40 2010 UTC (13 years, 4 months ago) by niro
File size: 1521 byte(s)
-import from 050
1 <?
2 /* das script benötigt folgende tabellen in der datenbank:
3 * ssh_auth_clients spalten -> serial [int 11], public_key [text]
4 * ssh_auth_server spalten -> id [int 11], public_key [text]
5 *
6 * du musst auf jeden fall den ping befehl anpassen und der pfad zum hostfile auf dem
7 * apache2 lautet '/home/httpd/.ssh/known_host', evtl müsste das verzeichnis .ssh erstellt werden
8 *
9 * that's it, works4me (TM)
10 */
11 include('include/config.inc.php');
12 include('include/dbconn.php');
13
14 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>';
16
17 $pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$client.'');
18 while ($row = mysql_fetch_row ($pubkey)) {
19
20 # schreiben der .ssh/known_hosts file mit dem public rsa key des client,
21 # um die "yes" abfrage zu vermeiden
22 $hostfile = fopen ($home."/.ssh/known_hosts","w");
23 fwrite($hostfile,$ip." ".$row[0],strlen($row[0])+strlen($ip)+1);
24 fclose($hostfile);
25
26 # reboot des clients
27 passthru($pingcmd.' '.$ip.' &> /dev/null && exit 0 || exit 1',$retval);
28 if($retval==0) {
29 echo '<img src="pics/online.gif" align=top> '.strtoupper($op.'ing client #'.$client.' ('.$ip.')...<br>');
30 system($sshcmd.' -l root -o ConnectTimeout=5 '.$ip.' /sbin/'.$op);
31 }
32 else echo '<img src="pics/offline.gif" align=top> '.strtoupper('Client not online, try again later...<br>');
33 }
34 echo '</td></tr></table>';
35 ?>

Properties

Name Value
svn:executable *