function dnsmasq(){ if(!$GLOBALS["CLASS_USERS"]->dnsmasq_installed){ if($GLOBALS["VERBOSE"]){echo "dnsmasq_installed FALSE\n";} return; } $EnableDNSMASQ=$GLOBALS["CLASS_SOCKETS"]->GET_INFO("EnableDNSMASQ"); if(!is_numeric($EnableDNSMASQ)){$EnableDNSMASQ=1;} if($GLOBALS["CLASS_USERS"]->POWER_DNS_INSTALLED){ $EnablePDNS=$GLOBALS["CLASS_SOCKETS"]->GET_INFO("EnablePDNS"); if(!is_numeric($EnablePDNS)){$EnablePDNS=1;} } if($GLOBALS["CLASS_USERS"]->BIND9_INSTALLED){$EnableDNSMASQ=0;} $binpath=$GLOBALS["CLASS_UNIX"]->find_program('dnsmasq'); if($binpath==null){ if($GLOBALS["VERBOSE"]){echo "dnsmasq no such binary.\n";} return; } $pid_path=_dnsmasq_pid(); if($pid_path<>null){$master_pid=$GLOBALS["CLASS_UNIX"]->get_pid_from_file($pid_path);} if(!is_numeric($master_pid)){$master_pid=$GLOBALS["CLASS_UNIX"]->PIDOF_PATTERN($binpath);} if(!$GLOBALS["CLASS_UNIX"]->process_exists($master_pid)){ $master_pid=$GLOBALS["CLASS_UNIX"]->PIDOF($binpath); } if($EnablePDNS==1){$EnableDNSMASQ=0;} $l[]="[DNSMASQ]"; $l[]="service_name=APP_DNSMASQ"; $l[]="service_cmd=dnsmasq"; $l[]="master_version=".GetVersionOf("dnsmasq"); $l[]="service_disabled=$EnableDNSMASQ"; $l[]="family=network"; $l[]="watchdog_features=1"; if($EnableDNSMASQ==0){return implode("\n",$l);return;} if(!$GLOBALS["CLASS_UNIX"]->process_exists($master_pid)){ WATCHDOG("APP_DNSMASQ","dnsmasq"); $l[]="running=0\ninstalled=1";$l[]=""; return implode("\n",$l); return; } $l[]="running=1"; $l[]=GetMemoriesOf($master_pid); $l[]=""; return implode("\n",$l);return; }
function dnsmasq() { if (!$GLOBALS["CLASS_USERS"]->dnsmasq_installed) { if ($GLOBALS["VERBOSE"]) { echo "dnsmasq_installed FALSE\n"; } return; } $binpath = $GLOBALS["CLASS_UNIX"]->find_program('dnsmasq'); if ($binpath == null) { if ($GLOBALS["VERBOSE"]) { echo "dnsmasq no such binary.\n"; } return; } $EnableDNSMASQ = $GLOBALS["CLASS_SOCKETS"]->dnsmasq_enabled(); $NoStopBind9 = $GLOBALS["CLASS_SOCKETS"]->GET_INFO("NoStopBind9"); if (!is_numeric($NoStopBind9)) { $NoStopBind9 = 0; } if ($GLOBALS["CLASS_USERS"]->BIND9_INSTALLED) { if ($NoStopBind9 == 0) { $namedbin = $GLOBALS["CLASS_UNIX"]->find_program("named"); $namedpid = $GLOBALS["CLASS_UNIX"]->PIDOF("{$namedbin}"); if ($GLOBALS["CLASS_UNIX"]->process_exists($namedpid)) { $nohup = $GLOBALS["CLASS_UNIX"]->find_program("nohup"); $kill = $GLOBALS["CLASS_UNIX"]->find_program("kill"); $GLOBALS["CLASS_UNIX"]->KILL_PROCESS($namedpid, 9); $cmd = "{$nohup} {$GLOBALS["NICE"]}/etc/init.d/dnsmasq restart >/dev/null 2>&1 &"; shell_exec2($cmd); $GLOBALS["CLASS_UNIX"]->send_email_events("Stopping bind9 Pid {$namedpid}", "Artica has stopped bind9 process\nthis to prevent port conflicts with DnsMasq or PowerDNS.\nIf you did not want to Artica perform this operation do this operation:\necho \"1\" >/etc/artica-postfix/settings/Daemons/NoStopBind9\n", "system"); } } } $master_pid = _dnsmasq_pid(); $l[] = "[DNSMASQ]"; $l[] = "service_name=APP_DNSMASQ"; $l[] = "service_cmd=/etc/init.d/dnsmasq"; $l[] = "master_version=" . dnsmasq_version(); $l[] = "service_disabled={$EnableDNSMASQ}"; $l[] = "family=network"; $l[] = "watchdog_features=1"; if ($EnableDNSMASQ == 0) { return implode("\n", $l); return; } if (!$GLOBALS["CLASS_UNIX"]->process_exists($master_pid)) { if (!$GLOBALS["DISABLE_WATCHDOG"]) { $nohup = $GLOBALS["CLASS_UNIX"]->find_program("nohup"); shell_exec2("{$nohup} {$GLOBALS["NICE"]} /etc/init.d/dnsmasq start >/dev/null 2>&1 &"); } $l[] = "running=0\ninstalled=1"; $l[] = ""; return implode("\n", $l); } $l[] = "running=1"; $l[] = GetMemoriesOf($master_pid); $l[] = ""; shell_exec2("{$GLOBALS["nohup"]} {$GLOBALS["NICE"]} {$GLOBALS["PHP5"]} /usr/share/artica-postfix/exec.dnsmasq.php --varrun >/dev/null 2>&1 &"); return implode("\n", $l); return; }