--- alx-src/branches/alx-web-060/reboot.php 2011/05/09 16:31:38 2017 +++ alx-src/branches/alx-web-060/reboot.php 2011/06/07 18:28:14 2198 @@ -1,34 +1,16 @@ serial [int 11], public_key [text] - * ssh_auth_server spalten -> id [int 11], public_key [text] - * - * du musst auf jeden fall den ping befehl anpassen und der pfad zum hostfile auf dem - * apache2 lautet '/home/httpd/.ssh/known_host', evtl müsste das verzeichnis .ssh erstellt werden - * - * that's it, works4me (TM) - */ - include('include/dbconn.php'); +include('include/common-functions.php'); - echo ''; - echo '
'; +echo ''; +echo '
'; - $pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$client.''); - while ($row = mysql_fetch_row ($pubkey)) { +# reboot des clients +if(online($ip) == 0) +{ + echo ' '.strtoupper($op.'ing client #'.$client.' ('.$ip.')...
'); + sshdo('/sbin/'.$op, $ip); +} +else echo ' '.strtoupper('Client not online, try again later...
'); - # schreiben der .ssh/known_hosts file mit dem public rsa key des client, - # um die "yes" abfrage zu vermeiden - $hostfile = fopen ($home."/.ssh/known_hosts","w"); - fwrite($hostfile,$ip." ".$row[0],strlen($row[0])+strlen($ip)+1); - fclose($hostfile); - - # reboot des clients - passthru($pingcmd.' '.$ip.' &> /dev/null && exit 0 || exit 1',$retval); - if($retval==0) { - echo ' '.strtoupper($op.'ing client #'.$client.' ('.$ip.')...
'); - system($sshcmd.' '.$ip.' /sbin/'.$op); - } - else echo ' '.strtoupper('Client not online, try again later...
'); - } - echo '
'; +echo '
'; ?>