1 |
<? |
<? |
|
include('include/config.inc.php'); |
|
2 |
include('include/dbconn.php'); |
include('include/dbconn.php'); |
3 |
include('include/basesql.php'); |
include('include/basesql.php'); |
4 |
|
|
14 |
global $sshcmd; |
global $sshcmd; |
15 |
|
|
16 |
// sed cmd: ssh -l root 10.11.12.13 'sed -i -e "s|^\(VAR=\).*|\1\"VALUE\"| FILE' |
// sed cmd: ssh -l root 10.11.12.13 'sed -i -e "s|^\(VAR=\).*|\1\"VALUE\"| FILE' |
17 |
$str = $sshcmd.' -l root -o ConnectTimeout=5 '.$ip.' \'sed -i -e "s|^\\('.$var.'=\\).*|\\1\\"'.$value.'\\"|" '.$file.'\''; |
$str = $sshcmd.' '.$ip.' \'sed -i -e "s|^\\('.$var.'=\\).*|\\1\\"'.$value.'\\"|" '.$file.'\''; |
18 |
//echo $str.'<br>'; |
//echo $str.'<br>'; |
19 |
system($str); |
system($str); |
20 |
} |
} |
35 |
if($op=="calc") |
if($op=="calc") |
36 |
{ |
{ |
37 |
echo '<img src="pics/online.gif" align=top> '.strtoupper('Fetching list of packages to upgrade on client #'.$client.' ('.$ip.')...<br>'); |
echo '<img src="pics/online.gif" align=top> '.strtoupper('Fetching list of packages to upgrade on client #'.$client.' ('.$ip.')...<br>'); |
38 |
exec($sshcmd.' -l root -o ConnectTimeout=5 '.$ip.' /sbin/mageupgrade --calc-bash',$out,$err); |
exec($sshcmd.' '.$ip.' /sbin/mageupgrade --calc-bash',$out,$err); |
39 |
echo '<pre>'; |
echo '<pre>'; |
40 |
echo '<table border="0">'; |
echo '<table border="0">'; |
41 |
if (array_key_exists("0", $out)) |
if (array_key_exists("0", $out)) |
77 |
editvar("MAGE_RSYNC",$rsync,"/etc/alxconfig-ng/config.rc"); |
editvar("MAGE_RSYNC",$rsync,"/etc/alxconfig-ng/config.rc"); |
78 |
editvar("RSYNC",$rsync,"/etc/mage.rc"); |
editvar("RSYNC",$rsync,"/etc/mage.rc"); |
79 |
|
|
80 |
system($sshcmd.' -l root -o ConnectTimeout=5 '.$ip.' "NOCOLORS=true /sbin/mage update"'); |
system($sshcmd.' '.$ip.' "NOCOLORS=true /sbin/mage update"'); |
81 |
echo '</div></pre>'; |
echo '</div></pre>'; |
82 |
echo '<script language="JavaScript">alert(\'Database-update successfully completed on client #'.$client.' .\')</script>'; |
echo '<script language="JavaScript">alert(\'Database-update successfully completed on client #'.$client.' .\')</script>'; |
83 |
} |
} |
117 |
|
|
118 |
|
|
119 |
# check if /usr/sbin/update-alx exists, if not update mage-alx and alxconfig-alx first |
# check if /usr/sbin/update-alx exists, if not update mage-alx and alxconfig-alx first |
120 |
exec($sshcmd.' -l root -o ConnectTimeout=5 '.$ip.' "[ -x /usr/sbin/update-alx ] && exit 0 || exit 1"',$outarr,$err); |
exec($sshcmd.' '.$ip.' "[ -x /usr/sbin/update-alx ] && exit 0 || exit 1"',$outarr,$err); |
121 |
if($err!=0) |
if($err!=0) |
122 |
{ |
{ |
123 |
echo '"/usr/sbin/update-alx" missing on client "'.$client.'". Updating mage-alx and alxconfig-ng-alx first ...<br>'; |
echo '"/usr/sbin/update-alx" missing on client "'.$client.'". Updating mage-alx and alxconfig-ng-alx first ...<br>'; |
124 |
system($sshcmd.' -l root -o ConnectTimeout=5 '.$ip.' "NOCOLORS=true /sbin/mage install mage-alx"'); |
system($sshcmd.' '.$ip.' "NOCOLORS=true /sbin/mage install mage-alx"'); |
125 |
system($sshcmd.' -l root -o ConnectTimeout=5 '.$ip.' "NOCOLORS=true /sbin/mage install alxconfig-ng-alx"'); |
system($sshcmd.' '.$ip.' "NOCOLORS=true /sbin/mage install alxconfig-ng-alx"'); |
126 |
} |
} |
127 |
//system($sshcmd.' -l root -o ConnectTimeout=5 '.$ip.' "NOCOLORS=true /usr/sbin/update-alx"'); |
//system($sshcmd.' '.$ip.' "NOCOLORS=true /usr/sbin/update-alx"'); |
128 |
exec($sshcmd.' -l root -o ConnectTimeout=5 '.$ip.' "NOCOLORS=true /usr/sbin/update-alx && exit 0 || exit 1"',$outarr,$err); |
exec($sshcmd.' '.$ip.' "NOCOLORS=true /usr/sbin/update-alx && exit 0 || exit 1"',$outarr,$err); |
129 |
echo '</div></pre>'; |
echo '</div></pre>'; |
130 |
if ($err!=0) echo '<script language="JavaScript">alert(\'Upgrade *failed* on client #'.$client.' .\')</script>'; |
if ($err!=0) echo '<script language="JavaScript">alert(\'Upgrade *failed* on client #'.$client.' .\')</script>'; |
131 |
else echo '<script language="JavaScript">alert(\'Upgrade successfully installed on client #'.$client.' .\')</script>'; |
else echo '<script language="JavaScript">alert(\'Upgrade successfully installed on client #'.$client.' .\')</script>'; |