Annotation of /alx-src/trunk/alx-web/unused/get_process_info.php
Parent Directory | Revision Log
Revision 355 -
(hide annotations)
(download)
Mon Oct 10 19:42:06 2005 UTC (18 years, 7 months ago) by niro
File size: 1305 byte(s)
Mon Oct 10 19:42:06 2005 UTC (18 years, 7 months ago) by niro
File size: 1305 byte(s)
cvs import: alx-web for alxconfig-ng - code clean up and - reorganized the whole structure
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 | |||
12 | // $client = '16'; | ||
13 | // $ip = '128.20.40.61'; | ||
14 | // $op = 'reboot'; | ||
15 | |||
16 | include('dbconn.php'); | ||
17 | |||
18 | $pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$client.''); | ||
19 | while ($row = mysql_fetch_row ($pubkey)) { | ||
20 | // echo 'Client Public RSA-Key:<br>'; | ||
21 | // echo $row[0].'<br>'; | ||
22 | |||
23 | # schreiben der .ssh/known_hosts file mit dem public rsa key des client, | ||
24 | # um die "yes" abfrage zu vermeiden | ||
25 | $hostfile = fopen ("/home/httpd/.ssh/known_hosts","w"); | ||
26 | fwrite($hostfile,$ip." ".$row[0],strlen($row[0])+strlen($ip)+1); | ||
27 | fclose($hostfile); | ||
28 | |||
29 | # reboot des clients | ||
30 | passthru('/bin/ping -I eth0 -c 1 -W 1 -q '.$ip.' &> /dev/null && exit 0 || exit 1',$retval); | ||
31 | if($retval==0) { | ||
32 | echo strtoupper($op.'ing client "'.$ip.'" ...<br>'); | ||
33 | system('/usr/bin/ssh -l root '.$ip.' /sbin/'.$op); | ||
34 | } | ||
35 | else echo strtoupper('Client not online, try again later...<br>'); | ||
36 | } | ||
37 | echo '<br>'; | ||
38 | ?> |
Properties
Name | Value |
---|---|
svn:executable | * |