Annotation of /alx-src/trunk/alx-web/reboot.php
Parent Directory | Revision Log
Revision 424 -
(hide annotations)
(download)
Wed Jun 4 21:54:04 2008 UTC (16 years, 3 months ago) by niro
File size: 1501 byte(s)
Wed Jun 4 21:54:04 2008 UTC (16 years, 3 months ago) by niro
File size: 1501 byte(s)
-import from upstream
1 | niro | 355 | <? |
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 | niro | 424 | include('include/config.inc.php'); |
12 | include('include/dbconn.php'); | ||
13 | niro | 355 | |
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 | niro | 424 | $hostfile = fopen ($home."/.ssh/known_hosts","w"); |
23 | niro | 355 | fwrite($hostfile,$ip." ".$row[0],strlen($row[0])+strlen($ip)+1); |
24 | fclose($hostfile); | ||
25 | |||
26 | # reboot des clients | ||
27 | niro | 424 | passthru($pingcmd.' '.$ip.' &> /dev/null && exit 0 || exit 1',$retval); |
28 | niro | 355 | if($retval==0) { |
29 | echo '<img src="pics/online.gif" align=top> '.strtoupper($op.'ing client #'.$client.' ('.$ip.')...<br>'); | ||
30 | niro | 424 | system($sshcmd.' -l root '.$ip.' /sbin/'.$op); |
31 | niro | 355 | } |
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 | * |