Magellan Linux

Contents of /alx-src/trunk/alx-web/unused/client_services.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 355 - (show annotations) (download)
Mon Oct 10 19:42:06 2005 UTC (18 years, 6 months ago) by niro
File size: 1004 byte(s)
cvs import: alx-web for alxconfig-ng
 - code clean up and
 - reorganized the whole structure

1 <?
2 #$client = '9';
3 #$ip = '128.20.40.170';
4 #$op = 'status'; // status, stop, start, restart
5 #$service= 'xdm-alx';
6
7 echo 'client = '.$client.'<br>';
8 echo 'ip = '.$ip.'<br>';
9 echo 'op = '.$op.'<br>';
10 echo 'service = '.$service.'<br>';
11
12
13 include('dbconn.php');
14
15 $pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$client.'');
16 while ($row = mysql_fetch_row ($pubkey)) {
17 # schreiben der .ssh/known_hosts file mit dem public rsa key des client,
18 # um die "yes" abfrage zu vermeiden
19 $hostfile = fopen ("/home/httpd/.ssh/known_hosts","w");
20 fwrite($hostfile,$ip." ".$row[0],strlen($row[0])+strlen($ip)+1);
21 fclose($hostfile);
22
23 # reboot des clients
24 passthru('/bin/ping -I eth0 -c 1 -W 1 -q '.$ip.' &> /dev/null && exit 0 || exit 1',$retval);
25 if($retval==0) {
26 passthru('./check_services.sh '.$ip.' '.$service.' '.$op.'',$i);
27 }
28 else echo strtoupper('Client not online, try again later...<br>');
29 }
30 echo '<br>';
31 ?>

Properties

Name Value
svn:executable *