# echo '
'; echo '';
include('include/dbconn.php');
# $client = '1';
# $ip = '192.168.0.159';
# $op = 'calcdsfs';
$home = '/home/www-data';
# $update_alx_cmd = 'NOCOLORS=true
# /usr/sbin/update-alx
# --user tjoke
# --pass strunz
# --server-share //192.168.0.2/magetmp
# --min-space 50000
# --mirrors http://192.168.0.2/magellan-050
# --rsync rsync://192.168.0.2/mage-cvs-alx
# --profile alx-050';
# --proxy
# --ftp-proxy
# --http-proxy
# --no-proxy';
?>
$pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$client.'');
while ($row = mysql_fetch_row ($pubkey))
{
# 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('/usr/sbin/fping -c 1 -t 50 -q '.$ip.' &> /dev/null && exit 0 || exit 1',$retval);
if($retval==0)
{
if($op=="calc")
{
echo ' '.strtoupper('Fetching list of packages to upgrade on client #'.$client.' ('.$ip.')... '); exec('/usr/bin/ssh -l root '.$ip.' /sbin/mageupgrade --calc-bash',$out,$err); echo ' '; echo '
'); echo ' '; echo ' '; } elseif($op=="upgrade") { echo ' '.strtoupper('Running update-alx on client #'.$client.' ('.$ip.')... '); echo ' '; echo ' '; } else echo 'unkown operation'; } else echo ' '.strtoupper('Client not online, try again later... '); } echo ' |