function BuildDHCP() { $ldap = new clladp(); if ($ldap->ldapFailed) { echo "Starting......: DHCP SERVER ldap connection failed,aborting\n"; return; } if (!$ldap->ExistsDN("dc=organizations,{$ldap->suffix}")) { echo "Starting......: DHCP SERVER dc=organizations,{$ldap->suffix} no such branch, aborting\n"; return; } echo "Starting......: DHCP SERVER ldap connection success\n"; $dhcpd = new dhcpd(); $conf = $dhcpd->BuildConf(); $confpath = dhcp3Config(); $unix = new unix(); @mkdir(dirname($confpath), null, true); @file_put_contents($confpath, $conf); echo "Starting......: DHCP SERVER saving \"{$confpath}\" (" . strlen($conf) . " bytes) done\n"; if (is_dir("/var/lib/dhcp3")) { shell_exec("/bin/chown -R dhcpd:dhcpd /var/lib/dhcp3"); shell_exec("/bin/chmod 755 /var/lib/dhcp3"); } $complain = $unix->find_program("aa-complain"); if (is_file($complain)) { $dhcpd3 = $unix->find_program("dhcpd3"); if (is_file($dhcpd3)) { shell_exec("{$complain} {$dhcpd3} >/dev/null 2>&1"); } } }
function BuildDHCP(){ $dhcpd=new dhcpd(); $conf=$dhcpd->BuildConf(); $confpath=dhcp3Config(); $unix=new unix(); @mkdir(dirname($confpath),null,true); @file_put_contents($confpath,$conf); echo "Starting......: DHCP SERVER saving \"$confpath\" (". strlen($conf)." bytes) done\n"; if(is_dir("/var/lib/dhcp3")){ shell_exec("/bin/chown -R dhcpd:dhcpd /var/lib/dhcp3"); shell_exec("/bin/chmod 755 /var/lib/dhcp3"); } $complain=$unix->find_program("aa-complain"); if(is_file($complain)){ $dhcpd3=$unix->find_program("dhcpd3"); if(is_file($dhcpd3)){shell_exec("$complain $dhcpd3 >/dev/null 2>&1");} } }
function BuildDHCP() { $dhcpd = new dhcpd(); $dhcpd->BuildConf(); $dhcpd->Save(); }
function BuildDHCP($nopid = false) { $LOGBIN = "DHCP Server"; $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time"; $unix = new unix(); if (!$nopid) { if (!$GLOBALS["FORCE"]) { if ($unix->file_time_min($timefile) < 2) { if ($GLOBALS["VERBOSE"]) { echo "{$timefile} -> is less than 2mn\n"; } return; } } } build_progress("{starting_service}", 65); $dhcpd = new dhcpd(); $conf = $dhcpd->BuildConf(); $confpath = dhcp3Config(); $unix = new unix(); @mkdir(dirname($confpath), null, true); @file_put_contents($confpath, $conf); echo "Starting......: " . date("H:i:s") . " [INIT]: {$LOGBIN} saving \"{$confpath}\" (" . strlen($conf) . " bytes) done\n"; if (!$unix->UnixUserExists("dhcpd")) { $unix->CreateUnixUser("dhcpd", "dhcpd"); } if (!is_dir("/var/lib/dhcp3")) { @mkdir("/var/lib/dhcp3", 0755, true); } $unix->chown_func("dhcpd", "dhcpd", "/var/lib/dhcp3/*"); $unix->chmod_func(0755, "/var/lib/dhcp3"); $complain = $unix->find_program("aa-complain"); if (is_file($complain)) { $dhcpd3 = $unix->DHCPD_BIN_PATH(); if (is_file($dhcpd3)) { shell_exec("{$complain} {$dhcpd3} >/dev/null 2>&1"); } } @unlink($timefile); @file_put_contents($timefile, time()); if ($GLOBALS["PROGRESS"]) { build_progress("{starting_service}", 70); $sock = new sockets(); $sock->getFrameWork("dnsmasq.php?restart=yes"); $sock->getFrameWork("services.php?restart-monit=yes"); $sock->getFrameWork("cmd.php?restart-artica-status=yes"); } }