<?php if (posix_getuid() != 0) { die("Cannot be used in web server mode\n\n"); } include_once dirname(__FILE__) . '/ressources/class.users.menus.inc'; include_once dirname(__FILE__) . '/ressources/class.dhcpd.inc'; include_once dirname(__FILE__) . '/ressources/class.user.inc'; include_once dirname(__FILE__) . '/ressources/class.ini.inc'; include_once dirname(__FILE__) . '/ressources/class.iptables-chains.inc'; include_once dirname(__FILE__) . '/ressources/class.baseunix.inc'; include_once dirname(__FILE__) . '/ressources/class.bind9.inc'; include_once dirname(__FILE__) . "/framework/frame.class.inc"; if ($argv[1] == '--bind') { compile_bind(); die; } BuildDHCP(); function BuildDHCP() { $dhcpd = new dhcpd(); $dhcpd->BuildConf(); $dhcpd->Save(); } function compile_bind() { $bind = new bind9(); $bind->Compile(); $bind->SaveToLdap(); }
function reload() { $unix = new unix(); $LOGBIN = "DHCP Server"; $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { $time = $unix->PROCCESS_TIME_MIN($pid); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} Already Artica task running PID {$pid} since {$time}mn\n"; } return; } @file_put_contents($pidfile, getmypid()); $pid = PID_NUM(); $time = $unix->PROCCESS_TIME_MIN($pid); $nohup = $unix->find_program("nohup"); $php5 = $unix->LOCATE_PHP5_BIN(); $kill = $unix->find_program("kill"); BuildDHCP(true); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} reloading PID {$pid} since {$time}mn\n"; } stop(true); start(true); }