".gettext("Gestion des onduleurs")."";
// ###################### Variables ##############################//
$lien = "ups.php";
$xmlfile = "/var/www/se3/ups/ups.xml";
$conffile = "/etc/nut/ups.conf";
$lang_ups_titre = "Configuration de l'onduleur: Esclave ";
//###############################################################################################//
$ipmaster=isset($_POST['ipmaster']) ? $_POST['ipmaster'] : "";
if ($ipmaster!="") { // Si on a recu une IP on la verifie
$ok=1;
if (!is_string($ipmaster)) {$ok = 0;}
$ip_long = ip2long($ipmaster);
$ip_revers = long2ip($ip_long);
if($ipmaster != $ip_revers) {$ok=0;}
}
if($ok=="1") { // If IP is Ok
$fp=fopen("/etc/nut/upsmon.conf","w+");
$upsmon_var = "MONITOR myups@$ipmaster 1 monslave wawa slave\nMINSUPPLIES 1\nSHUTDOWNCMD \"/sbin/shutdown -h +1\"\nPOLLFREQ 5\nPOLLFREQALERT 5\nHOSTSYNC 15\nDEADTIME 15\nPOWERDONFLAG /etc/killpower\nRBWARNTIME 43200\nNOCOMMWARNTIME 300\nFINALDELAY 5\nNOTIFYCMD /usr/share/se3/sbin/mail_alertes_ups.sh\nNOTIFYFLAG ONBATT SYSLOG+EXEC\n";
fputs($fp,$upsmon_var);
fclose($fp);
$fp=fopen("/etc/nut/ipmaster","w+");
fputs($fp,$ipmaster);
fclose($fp);
$fp=fopen("/etc/nut/hosts.conf","w+");
$hosts_var = "MONITOR myups@".$ipmaster." \"UPS slave\"";
fputs($fp,$hosts_var);
fclose($fp);
echo gettext("Veuillez patienter ...!");
echo "
";
echo "Configurer";
exec ("/usr/bin/sudo /usr/share/se3/scripts/ups.sh");
echo "";
exit;
} else { // Si pas encore d'IP
$text = "
";
$text .= "
"; $text .= ""; $text .= " | ";
$text .= "\n";
print "$text\n";
echo "\n";
} else
echo "$html ".gettext("Cette fonctionnalit\xe9, n\xe
9cessite les droits d'administrateur du serveur Se3 !")." ";
require ("pdp.inc.php");
?>
|