Contents of /alx-src/branches/alx-web-050/reboot.php
Parent Directory | Revision Log
Revision 1608 -
(show annotations)
(download)
Thu Dec 2 22:13:04 2010 UTC (13 years, 9 months ago) by niro
File size: 1457 byte(s)
Thu Dec 2 22:13:04 2010 UTC (13 years, 9 months ago) by niro
File size: 1457 byte(s)
-consequently use commands defined in config.inc.php
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/dbconn.php'); |
12 | |
13 | echo '<body onload="window.setTimeout(\'window.close()\', 1750)">'; |
14 | echo '<table width=100% height=100% style="border:solid black 1px; background-color:#d5e5ff"><tr><td valign=middle align=center>'; |
15 | |
16 | $pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$client.''); |
17 | while ($row = mysql_fetch_row ($pubkey)) { |
18 | |
19 | # schreiben der .ssh/known_hosts file mit dem public rsa key des client, |
20 | # um die "yes" abfrage zu vermeiden |
21 | $hostfile = fopen ($home."/.ssh/known_hosts","w"); |
22 | fwrite($hostfile,$ip." ".$row[0],strlen($row[0])+strlen($ip)+1); |
23 | fclose($hostfile); |
24 | |
25 | # reboot des clients |
26 | passthru($pingcmd.' '.$ip.' &> /dev/null && exit 0 || exit 1',$retval); |
27 | if($retval==0) { |
28 | echo '<img src="pics/online.gif" align=top> '.strtoupper($op.'ing client #'.$client.' ('.$ip.')...<br>'); |
29 | system($sshcmd.' '.$ip.' /sbin/'.$op); |
30 | } |
31 | else echo '<img src="pics/offline.gif" align=top> '.strtoupper('Client not online, try again later...<br>'); |
32 | } |
33 | echo '</td></tr></table>'; |
34 | ?> |
Properties
Name | Value |
---|---|
svn:executable | * |