• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP unix_system_HUP函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中unix_system_HUP函数的典型用法代码示例。如果您正苦于以下问题:PHP unix_system_HUP函数的具体用法?PHP unix_system_HUP怎么用?PHP unix_system_HUP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了unix_system_HUP函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: reload

function reload()
{
    $unix = new unix();
    $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 "Reloading.....: [INIT]: Already task running PID {$pid} since {$time}mn\n";
        }
        return;
    }
    $pid = ZARAFA_SEARCH_PID();
    if (!$unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Reloading.....: [INIT]: {$GLOBALS["SERVICE_NAME"]} stopped...\n";
        }
        $php5 = $unix->LOCATE_PHP5_BIN();
        shell_exec("{$php5} " . __FILE__ . " --start");
        return;
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Reloading.....: [INIT]: {$GLOBALS["SERVICE_NAME"]} reloading PID {$pid}...\n";
    }
    $kill = $unix->find_program("kill");
    unix_system_HUP($pid);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:27,代码来源:exec.zarafa-search.php


示例2: SingleInstance_reload

function SingleInstance_reload()
{
    $unix = new unix();
    SingleInstance();
    $pid = SingleInstance_pid();
    if ($unix->process_exists($pid)) {
        $timepid = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "{$GLOBALS["deflog_start"]} reloading executed {$pid} since {$timepid}Mn...\n";
        }
        unix_system_HUP($pid);
        sleep(2);
        $pid = SingleInstance_pid();
        if (!$unix->process_exists($pid)) {
            SingleInstance_start(true);
        }
        return;
    }
    SingleInstance_start(true);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:20,代码来源:exec.milter-greylist.php


示例3: build_ufdbguard_HUP

function build_ufdbguard_HUP()
{
    if (isset($GLOBALS["build_ufdbguard_HUP_EXECUTED"])) {
        return;
    }
    $GLOBALS["build_ufdbguard_HUP_EXECUTED"] = true;
    $unix = new unix();
    $sock = new sockets();
    $forceTXT = null;
    $ufdbguardReloadTTL = intval($sock->GET_INFO("ufdbguardReloadTTL"));
    if ($ufdbguardReloadTTL < 1) {
        $ufdbguardReloadTTL = 10;
    }
    $php5 = $unix->LOCATE_PHP5_BIN();
    $rm = $unix->find_program("rm");
    shell_exec("{$php5} /usr/share/artica-postfix/exec.ufdbclient.reload.php");
    shell_exec("{$rm} /home/squid/error_page_cache/*");
    if (function_exists("debug_backtrace")) {
        $trace = @debug_backtrace();
        if (isset($trace[1])) {
            $called = "called by " . basename($trace[1]["file"]) . " {$trace[1]["function"]}() line {$trace[1]["line"]}";
        }
    }
    $trace = debug_backtrace();
    if (isset($trace[1])) {
        $called = " called by " . basename($trace[1]["file"]) . " {$trace[1]["function"]}() line {$trace[1]["line"]}";
    }
    $timeFile = "/etc/artica-postfix/pids/UfdbGuardReload.time";
    $TimeReload = $unix->file_time_min($timeFile);
    if (!$GLOBALS["FORCE"]) {
        if ($TimeReload < $ufdbguardReloadTTL) {
            build_progress("{reloading_service} {failed}", 110);
            $unix->_syslog("Webfiltering service Aborting reload, last reload since {$TimeReload}Mn, need at least {$ufdbguardReloadTTL}Mn", basename(__FILE__));
            echo "Starting......: " . date("H:i:s") . " Webfiltering service Aborting reload, last reload since {$TimeReload}Mn, need at least {$ufdbguardReloadTTL}Mn\n";
            return;
        }
    } else {
        echo "Starting......: " . date("H:i:s") . " --- FORCED --- ufdbGuard last reload was {$TimeReload}mn\n";
    }
    @unlink($timeFile);
    @file_put_contents($timeFile, time());
    $pid = ufdbguard_pid();
    build_progress("{reloading_service} {$pid}", 71);
    $squidbin = $unix->LOCATE_SQUID_BIN();
    $ufdbguardd = $unix->find_program("ufdbguardd");
    if (strlen($ufdbguardd) < 5) {
        WriteToSyslogMail("ufdbguardd no such binary", basename(__FILE__));
        return;
    }
    $kill = $unix->find_program("kill");
    if ($unix->process_exists($pid)) {
        $processTTL = intval($unix->PROCCESS_TIME_MIN($pid));
        $LastTime = intval($unix->file_time_min($timeFile));
        build_progress("{reloading_service} {$pid} {$processTTL}Mn", 72);
        echo "Starting......: " . date("H:i:s") . " Webfiltering service Reloading service TTL {$processTTL}Mn\n";
        echo "Starting......: " . date("H:i:s") . " Webfiltering service Reloading service Last config since {$LastTime}Mn\n";
        echo "Starting......: " . date("H:i:s") . " Webfiltering service Reloading Max reload {$ufdbguardReloadTTL}Mn\n";
        if (!$GLOBALS["FORCE"]) {
            echo "Starting......: " . date("H:i:s") . " Webfiltering service Reloading force is disabled\n";
            if ($LastTime < $ufdbguardReloadTTL) {
                squid_admin_mysql(2, "Reloading Web Filtering PID: {$pid} [Aborted] last reload {$LastTime}Mn, need {$ufdbguardReloadTTL}mn", null, __FILE__, __LINE__);
                echo "Starting......: " . date("H:i:s") . " Webfiltering service Reloading service Aborting... minimal time was {$ufdbguardReloadTTL}mn - Current {$LastTime}mn\n{$called}\n";
                return;
            }
            if ($processTTL < $ufdbguardReloadTTL) {
                squid_admin_mysql(2, "Reloading Web Filtering PID: {$pid} [Aborted] {$processTTL}Mn, need {$ufdbguardReloadTTL}mn", null, __FILE__, __LINE__);
                echo "Starting......: " . date("H:i:s") . " Webfiltering service PID: {$pid}  Reloading service Aborting... minimal time was {$ufdbguardReloadTTL}mn\n{$called}\n";
                return;
            }
        }
        if ($GLOBALS["FORCE"]) {
            $forceTXT = " with option FORCE enabled";
            $prefix = "[FORCED]:";
        }
        @unlink($timeFile);
        @file_put_contents($timeFile, time());
        echo "Starting......: " . date("H:i:s") . " Webfiltering service Reloading service PID:{$pid} {$processTTL}mn\n";
        squid_admin_mysql(1, "{$prefix}Reloading Web Filtering service PID: {$pid} TTL {$processTTL}Mn", "{$forceTXT}\n{$called}\n{$GLOBALS["CMDLINEXEC"]}");
        build_progress("{reloading_service} HUP {$pid}", 75);
        unix_system_HUP($pid);
        build_progress("{reloading_proxy_service}", 76);
        shell_exec("{$php5} /usr/share/artica-postfix/exec.ufdbclient.reload.php");
        $squidbin = $unix->LOCATE_SQUID_BIN();
        squid_admin_mysql(1, "{$prefix}Reloading Proxy service", null, __FILE__, __LINE__);
        system("{$squidbin} -k reconfigure");
        return true;
    }
    squid_admin_mysql(1, "Warning, Reloading Web Filtering but not running [action=start]", "{$forceTXT}\n{$called}\n{$GLOBALS["CMDLINEXEC"]}");
    echo "Starting......: " . date("H:i:s") . " Webfiltering service reloading service no pid is found, Starting service...\n";
    @unlink($timeFile);
    @file_put_contents($timeFile, time());
    build_progress("{starting_service}", 76);
    if (!ufdbguard_start()) {
        return;
    }
    echo "Starting......: " . date("H:i:s") . " Webfiltering Service restarting ufdb-tail process\n";
    shell_exec("/etc/init.d/ufdb-tail restart");
    shell_exec("{$php5} /usr/share/artica-postfix/exec.ufdbclient.reload.php");
    squid_admin_mysql(1, "{$prefix}Reloading Proxy service", null, __FILE__, __LINE__);
    system("{$squidbin} -k reconfigure");
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.squidguard.php


示例4: SingleInstance_reload

function SingleInstance_reload()
{
    $unix = new unix();
    SingleInstance();
    $pid = SingleInstance_pid();
    if ($unix->process_exists($pid)) {
        $timepid = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "{$GLOBALS["deflog_start"]} reloading executed {$pid} since {$timepid}Mn...\n";
        }
        unix_system_HUP($pid);
        sleep(2);
        $pid = SingleInstance_pid();
        if (!$unix->process_exists($pid)) {
            SingleInstance_start(true);
        }
        return;
    }
    $PHP = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    shell_exec("{$nohup} {$PHP} /usr/share/artica-postfix/exec.spamassassin.php --whitelist >/dev/null 2>&1 &");
    SingleInstance_start(true);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:23,代码来源:exec.milter-greylist.php


示例5: reload

function reload($nopid = false)
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    if (!$nopid) {
        $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]: Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return;
        }
    }
    @file_put_contents($pidfile, getmypid());
    $sock = new sockets();
    $Enablentopng = $sock->GET_INFO("Enablentopng");
    if (!is_numeric($Enablentopng)) {
        $Enablentopng = 0;
    }
    if ($Enablentopng == 0) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Disabled ( see Enablentopng )...\n";
        }
        return;
    }
    build();
    $masterbin = $unix->find_program("ntopng");
    if (!is_file($masterbin)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Reload........: [INIT]: {$GLOBALS["SERVICE_NAME"]} not installed\n";
        }
        return;
    }
    $pid = ntopng_pid();
    $kill = $unix->find_program("kill");
    if ($unix->process_exists($pid)) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "Reload........: [INIT]: {$GLOBALS["SERVICE_NAME"]} Service running since {$time}Mn...\n";
        }
        unix_system_HUP($pid);
        return;
    }
    start(true);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:46,代码来源:exec.ntopng.php


示例6: reload

function reload()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $sock = new sockets();
    $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]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
        }
        return;
    }
    $pid = PID_NUM();
    if ($unix->process_exists($pid)) {
        $unix->_syslog("{$GLOBALS["TITLENAME"]} Reloading PID {$pid}\n", basename(__FILE__));
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Reloading PID {$pid}\n";
        }
        CheckDirectories();
        buildconfig();
        unix_system_HUP($pid);
    } else {
        start(true);
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:26,代码来源:exec.ufdbcat.php


示例7: reload

function reload()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $sock = new sockets();
    $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]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
        }
        return;
    }
    $DisableUfdbCat = $sock->DisableUfdbCat();
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} DisableUfdbCat= {$DisableUfdbCat}\n";
    }
    if ($DisableUfdbCat == 1) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service disabled (see DisableUfdbCat)\n";
        }
        stop();
        return;
    }
    $pid = PID_NUM();
    $time = $unix->PROCCESS_TIME_MIN($pid);
    if ($unix->process_exists($pid)) {
        CheckDirectories(true);
        CheckDirectoriesTLSE();
        buildconfig();
        $unix->_syslog("{$GLOBALS["TITLENAME"]} Reloading PID {$pid} (running since {$time}Mn)\n", basename(__FILE__));
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Reloading PID {$pid}\n";
        }
        squid_admin_mysql(1, "Reloading Categories service (running since {$time}Mn)", null, __FILE__, __LINE__);
        unix_system_HUP($pid);
    } else {
        start(true);
    }
}
开发者ID:articatech,项目名称:artica,代码行数:40,代码来源:exec.ufdbcat.php


示例8: reload

function reload($aspid = false)
{
    $unix = new unix();
    if (!$aspid) {
        $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 "Reloading.....: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return;
        }
        @file_put_contents($pidfile, getmypid());
    }
    CheckPermissions();
    BuildConfig();
    $pid = PID_NUM();
    if (!$unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Reloading.....: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Not running, start it...\n";
        }
        start(true);
        return;
    }
    $time = $unix->PROCCESS_TIME_MIN($pid);
    if ($GLOBALS["OUTPUT"]) {
        echo "Reloading.....: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} cyrus-imapd running since {$time}mn\n";
    }
    $kill = $unix->find_program("kill");
    unix_system_HUP($pid);
    $unix->CreateUnixUser("postfix", "postfix");
    $lmtpsocket = "/var/spool/postfix/var/run/cyrus/socket/lmtp";
    for ($i = 1; $i < 5; $i++) {
        if ($unix->is_socket($lmtpsocket)) {
            if ($GLOBALS["OUTPUT"]) {
                echo "Reloading.....: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Waiting socket success..\n";
            }
            $unix->chown_func("postfix", "postfix", "/var/spool/postfix/var/run");
            $unix->chown_func("postfix", "postfix", "{$lmtpsocket}");
            break;
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Reloading.....: " . date("H:i:s") . " {$GLOBALS["TITLENAME"]} Waiting socket {$i}/5\n";
        }
        sleep(1);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:48,代码来源:exec.cyrus-imapd.php


示例9: build_schedules


//.........这里部分代码省略.........
            continue;
        }
        if ($EnableRemoteStatisticsAppliance == 1) {
            if ($q->tasks_remote_appliance[$TaskType]) {
                $d++;
                continue;
            }
        }
        $md5 = md5("{$TimeText}{$TaskType}");
        if (isset($alreadydone[$md5])) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Starting......: " . date("H:i:s") . " artica-postfix watchdog task {$ligne["ID"]} already set\n";
            }
            continue;
        }
        $alreadydone[$md5] = true;
        if (!isset($q->tasks_processes[$TaskType])) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Starting......: " . date("H:i:s") . " artica-postfix task {$ligne["ID"]} no such task...\n";
            }
            $d++;
            continue;
        }
        if (isset($q->tasks_disabled[$TaskType])) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Starting......: " . date("H:i:s") . " artica-postfix task {$ligne["ID"]} is disabled or did not make sense...\n";
            }
            $d++;
            continue;
        }
        $script = $q->tasks_processes[$TaskType];
        if ($GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . " artica-postfix create task {$ligne["ID"]} type {$TaskType}..\n";
        }
        if (trim($ligne["TimeText"] == "{$allminutes} * * * *")) {
            $ligne["TimeText"] = "* * * * *";
        }
        $f = array();
        $f[] = "MAILTO=\"\"";
        $f[] = "{$ligne["TimeText"]}  root {$nice} {$php5} {$WorkingDirectory}/exec.schedules.php --run-squid {$ligne["ID"]} >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.d/squidsch-{$ligne["ID"]}", @implode("\n", $f));
        $c++;
        continue;
        if (trim($ligne["TimeText"] == "20,40,59 * * * *")) {
            $f[] = "@{$finalsettings},mail(false) 20 {$php5} {$WorkingDirectory}/{$script} --schedule-id={$ligne["ID"]} >/dev/null 2>&1";
            continue;
        }
        if (trim($ligne["TimeText"] == "0 * * * *")) {
            $f[] = "@{$finalsettings},mail(false) 1h {$php5} {$WorkingDirectory}/{$script} --schedule-id={$ligne["ID"]} >/dev/null 2>&1";
            continue;
        }
        if (trim($ligne["TimeText"] == "10,20,30,40,50 * * * *")) {
            $f[] = "@{$finalsettings},mail(false) 10 {$php5} {$WorkingDirectory}/{$script} --schedule-id={$ligne["ID"]} >/dev/null 2>&1";
            continue;
        }
        if (trim($ligne["TimeText"] == "0 0,3,5,7,9,11,13,15,17,19,23 * * *")) {
            $f[] = "@{$finalsettings},mail(false) 3h {$php5} {$WorkingDirectory}/{$script} --schedule-id={$ligne["ID"]} >/dev/null 2>&1";
            continue;
        }
        if (trim($ligne["TimeText"] == "0 2,4,6,8,10,12,14,16,18,20,22 * * *")) {
            $f[] = "@{$finalsettings},mail(false) 2h {$php5} {$WorkingDirectory}/{$script} --schedule-id={$ligne["ID"]} >/dev/null 2>&1";
            continue;
        }
        if (trim($ligne["TimeText"] == "0 0,2,4,6,8,10,12,14,16,18,20,22 * * *")) {
            $f[] = "@{$finalsettings},mail(false) 2h {$php5} {$WorkingDirectory}/{$script} --schedule-id={$ligne["ID"]} >/dev/null 2>&1";
            continue;
        }
        $f[] = "&{$finalsettings},mail(false) {$ligne["TimeText"]} {$php5} {$WorkingDirectory}/{$script} --schedule-id={$ligne["ID"]} >/dev/null 2>&1";
    }
    @file_put_contents("/etc/artica-postfix/squid.schedules", implode("\n", $f));
    if ($notfcron) {
        echo "Starting......: " . date("H:i:s") . " Squid {$c} scheduled tasks ({$d} disabled)\n";
        return;
    }
    $cron_path = $unix->find_program("cron");
    $kill = $unix->find_program("kill");
    $cron_pid = null;
    if (is_file("/var/run/cron.pid")) {
        $cron_pid = $unix->get_pid_from_file("/var/run/cron.pid");
    }
    if (!$unix->process_exists($cron_pid)) {
        $cron_pid = 0;
    }
    if (!is_numeric($cron_pid) or $cron_pid < 5) {
        $cron_pid = $unix->PIDOF("{$cron_path}");
    }
    if ($cron_pid > 5) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . " artica-postfix reloading {$cron_path} [{$cron_pid}]...\n";
        }
        unix_system_HUP("{$cron_pid}");
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "Starting......: " . date("H:i:s") . " artica-postfix reloading fcron...\n";
    }
    $nohup = $unix->find_program("nohup");
    shell_exec("{$nohup} /etc/init.d/artica-postfix restart fcron >/dev/null 2>&1 &");
    shell_exec("/etc/init.d/cron reload");
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.squid.php


示例10: reload_dnsmasq

function reload_dnsmasq()
{
    $sock = new sockets();
    $EnableDNSMASQ = $sock->GET_INFO("EnableDNSMASQ");
    if (!is_numeric($EnableDNSMASQ)) {
        $EnableDNSMASQ = 0;
    }
    if ($EnableDNSMASQ == 0) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} unable to reload DnsMASQ (not enabled)\n";
        return;
    }
    $unix = new unix();
    $EnableChilli = $sock->GET_INFO("EnableChilli");
    $chilli = $unix->find_program("chilli");
    if (!is_numeric($EnableChilli)) {
        $EnableChilli = 0;
    }
    if (is_file($chilli)) {
        if ($EnableChilli == 1) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} HotSpot is enabled, cannot use this instance\n";
            return;
        }
    }
    $dnsmasqbin = $unix->find_program("dnsmasq");
    if (is_file(!$dnsmasqbin)) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} unable to reload DnsMASQ (not such dsnmasq binary)\n";
        return;
    }
    $pid = $unix->PIDOF($dnsmasqbin);
    if (!is_numeric($pid)) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} unable to reload DnsMASQ (not running)\n";
        return;
    }
    echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} reloading PID:`{$pid}`\n";
    $kill = $unix->find_program("kill");
    unix_system_HUP($pid);
}
开发者ID:articatech,项目名称:artica,代码行数:37,代码来源:exec.dnsmasq.php


示例11: build


//.........这里部分代码省略.........
    if ($conf["VerifyIncoming"] == "yes") {
        $mode = $mode . "v";
        echo "Starting......: " . date("H:i:s") . " milter-dkim verify incoming mails\n";
    }
    $ldap = new clladp();
    $domains = $ldap->hash_get_all_domains();
    while (list($key, $value) = each($domains)) {
        $dd[] = $key;
    }
    echo "Starting......: " . date("H:i:s") . " milter-dkim " . count($dd) . " local domains\n";
    $Domain = @implode(",", $dd);
    $f[] = "ADSPDiscard\t\t\t{$conf["ADSPDiscard"]}";
    $f[] = "ADSPNoSuchDomain\t\t{$conf["ADSPNoSuchDomain"]}";
    $f[] = "AllowSHA1Only\t\t\tno";
    $f[] = "AlwaysAddARHeader\t\tno";
    $f[] = "AutoRestart\t\t\tyes";
    $f[] = "AutoRestartCount\t\t2";
    $f[] = "AutoRestartRate\t\t10/1h";
    $f[] = "Background\t\t\tYes";
    $f[] = "BaseDirectory\t\t\t/var/run/dkim-filter";
    $f[] = "BodyLengths\t\t\tNo";
    $f[] = "Canonicalization\t\tsimple/simple";
    $f[] = "ClockDrift\t\t\t300 ";
    $f[] = "Diagnostics\t\t\tyes";
    $f[] = "DNSTimeout\t\t\t10";
    $f[] = "Domain\t\t\t\t{$Domain}";
    $f[] = "EnableCoredumps\t\tno";
    $f[] = "ExternalIgnoreList\t/etc/mail/dkim/trusted-hosts";
    $f[] = "FixCRLF \t\t\t\tno";
    $f[] = "InternalHosts\t\t\t/etc/mail/dkim/internal-hosts";
    $f[] = "KeepTemporaryFiles\tno";
    $f[] = "KeyList \t\t\t\t/etc/mail/dkim/keylist";
    $f[] = "LogWhy\t\t\t\tyes";
    $f[] = "MilterDebug\t\t\t0";
    $f[] = "Mode\t\t\t\t\t{$mode}";
    $f[] = "On-Default         \t{$conf["On-Default"]}";
    $f[] = "On-BadSignature    \t{$conf["On-BadSignature"]}";
    $f[] = "On-DNSError        \t{$conf["On-DNSError"]}";
    $f[] = "On-InternalError   \t{$conf["On-InternalError"]}";
    $f[] = "On-NoSignature     \t{$conf["On-NoSignature"]}";
    $f[] = "On-Security        \t{$conf["On-Security"]}";
    $f[] = "PeerList\t\t\t\t/etc/mail/dkim/trusted-hosts";
    $f[] = "PidFile\t\t\t\t/var/run/dkim-milter/dkim-milter.pid";
    $f[] = "Quarantine\t\t\tNo";
    $f[] = "#QueryCache\t\t\tyes";
    $f[] = "RemoveARAll\t\t\tNo";
    $f[] = "RemoveOldSignatures\tNo";
    $f[] = "ReportAddress\t\t\[email protected]";
    $f[] = "RequiredHeaders\t\tNo";
    $f[] = "Selector\t\t\t\tdefault";
    $f[] = "SendADSPReports\t\tNo";
    $f[] = "SendReports\t\t\tNo";
    $f[] = "SignatureAlgorithm\trsa-sha256";
    $f[] = "SignatureTTL\t\t\t0";
    $f[] = "Socket\t\t\t\tlocal:/var/run/dkim-milter/dkim-milter.sock";
    $f[] = "StrictTestMode\t\tno";
    $f[] = "Syslog\t\t\t\tyes";
    $f[] = "SyslogFacility\t\tmail";
    $f[] = "SyslogSuccess\t\t\tyes";
    $f[] = "TemporaryDirectory\t/var/tmp";
    $f[] = "UMask\t\t\t\t\t022";
    $f[] = "UserID\t\t\t\tpostfix";
    $f[] = "X-Header\t\t\t\t{$conf["X-Header"]}";
    $f[] = "";
    /*
    *        KeyList (string)
    Gives the location of  a  file  listing  rules  for signing with mul‐tiple   keys.    If  present, overrides any KeyFile
    setting in the conifguration file.  The  file  named  here  should contain a set of lines of  the form
    sender‐pattern:signing‐domain:keypath where sender‐pattern is  a  pattern  to   match   against message  senders
    (with   the  special  character  "*" interpreted as "zero or more characters"), signing‐domain is the domain to   announce  as  
    the signing   domain   when  generating signatures, and keypath is the path to the PEM‐formatted private key to  be   used for  signing messages  which  match the sender‐pattern.
    The selector used in the signature  will  be  the  filename  portion  of keypath.   
    If  the file  referenced  by  keypath cannot be opened, the
    filter will try again by appending ".pem" and then  ".private"  before giving  up
    */
    //http://www.howtoforge.com/set-up-dkim-for-multiple-domains-on-postfix-with-dkim-milter-2.8.x-centos-5.3
    @mkdir("/etc/dkim-milter", null, true);
    @file_put_contents("/etc/dkim-milter/dkim-milter.conf", @implode("\n", $f));
    keyTable();
    WhitelistDomains();
    WhitelistHosts();
    MyNetworks();
    echo "Starting......: " . date("H:i:s") . " milter-dkim Apply permissions...\n";
    shell_exec("/bin/chmod 755 /etc/mail/dkim >/dev/null 2>&1");
    shell_exec("/bin/chmod 0770 /etc/mail/dkim/keys >/dev/null 2>&1");
    shell_exec("/bin/chmod 0770 /etc/mail/dkim/keys/* >/dev/null 2>&1");
    shell_exec("/bin/chmod 0770 /etc/mail/dkim/keys/*/* >/dev/null 2>&1");
    shell_exec("/bin/chown -R postfix:postfix /etc/mail/dkim >/dev/null 2>&1");
    echo "Starting......: " . date("H:i:s") . " milter-dkim Apply permissions done...\n";
    if ($GLOBALS["RELOAD"]) {
        $unix = new unix();
        $pid = $unix->get_pid_from_file("/var/run/dkim-milter/dkim-milter.pid");
        echo "Starting......: " . date("H:i:s") . " milter-dkim reloading current PID={$pid}\n";
        if ($unix->process_exists($pid)) {
            $kill = $unix->find_program("kill");
            echo "Starting......: " . date("H:i:s") . " milter-dkim reloading PID {$pid}\n";
            unix_system_HUP($pid);
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.dkim-milter.php


示例12: reload

function reload()
{
    $unix = new unix();
    $smbcontrol = $unix->find_program("smbcontrol");
    if (is_file($smbcontrol)) {
        shell_exec("{$smbcontrol} smbd reload-config");
        shell_exec("{$smbcontrol} winbindd reload-config");
        shell_exec("{$smbcontrol} nmbd reload-config");
        return;
    }
    $pidof = $unix->find_program("pidof");
    $smbd = $unix->find_program("smbd");
    $winbindd = $unix->find_program("winbindd");
    $kill = $unix->find_program("kill");
    exec("{$pidof} {$smbd} 2>&1", $results);
    echo "Starting......: " . date("H:i:s") . " samba reloading smbd:{$smbd}...\n";
    $tbl = explode(" ", @implode(" ", $results));
    while (list($index, $pid) = each($tbl)) {
        $pid = trim($pid);
        if (!is_numeric($pid)) {
            continue;
        }
        if ($pid < 10) {
            continue;
        }
        echo "Starting......: " . date("H:i:s") . " samba reloading smbd pid: {$pid}\n";
        unix_system_HUP($pid);
    }
    $results = array();
    exec("{$pidof} winbindd 2>&1", $results);
    echo "Starting......: " . date("H:i:s") . " samba reloading winbindd:{$smbd}...\n";
    $tbl = explode(" ", @implode(" ", $results));
    while (list($index, $pid) = each($tbl)) {
        $pid = trim($pid);
        if (!is_numeric($pid)) {
            continue;
        }
        if ($pid < 10) {
            continue;
        }
        echo "Starting......: " . date("H:i:s") . " samba reloading winbindd pid: {$pid}\n";
        unix_system_HUP($pid);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:44,代码来源:exec.samba.php


示例13: stop

function stop($nopid = false)
{
    $users = new usersMenus();
    $unix = new unix();
    if (!$users->ETTERCAP_INSTALLED) {
        echo "ArpSpoofing.........: [STOP]: Ettercap, not installed...\n";
        return;
    }
    $kill = $unix->find_program("kill");
    if (!$nopid) {
        $me = basename(__FILE__);
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, $me)) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            echo "ArpSpoofing.........: [START]: Ettercap, Already start instance executed PID {$pid} since {$time}Mn...\n";
            return;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $pids = GetAllPids();
    if (count($pids) == 0) {
        echo "ArpSpoofing.........: [STOP]: Ettercap, no instance in memory\n";
        return;
    }
    while (list($pid, $ruleid) = each($pids)) {
        echo "ArpSpoofing.........: [STOP]: stopping smoothly pid {$pid} for rule {$ruleid}\n";
        unix_system_HUP($pid);
        unix_system_kill($pid);
    }
    for ($i = 0; $i < 10; $i++) {
        $pids = GetAllPids();
        while (list($pid, $ruleid) = each($pids)) {
            if (!$unix->process_exists($pid)) {
                echo "ArpSpoofing.........: [STOP]: pid {$pid} for rule {$ruleid} stopped...\n";
                unset($pids[$pid]);
                continue;
            }
            echo "ArpSpoofing.........: [STOP]: pid {$pid} for rule {$ruleid} still alive...\n";
        }
        if (count($pids) == 0) {
            break;
        }
        sleep(1);
    }
    $pids = GetAllPids();
    if (count($pids) > 0) {
        reset($pids);
        while (list($pid, $ruleid) = each($pids)) {
            echo "ArpSpoofing.........: [STOP]: pid {$pid} for rule {$ruleid} force stopping...\n";
            unix_system_kill_force($pid);
        }
    }
    $pids = GetAllPids();
    if (count($pids) > 0) {
        reset($pids);
        while (list($pid, $ruleid) = each($pids)) {
            echo "ArpSpoofing.........: [STOP]: pid {$pid} for rule {$ruleid} failed stopping...\n";
        }
    }
    echo "ArpSpoofing.........: [STOP]: DONE...\n";
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:62,代码来源:exec.arpspoof.php


示例14: reload

function reload($aspid = false)
{
    $unix = new unix();
    $sock = new sockets();
    $Masterbin = $unix->find_program("clamd");
    if (!is_file($Masterbin)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, clamd not installed\n";
        }
        return;
    }
    if (!$aspid) {
        $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]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $pid = PID_NUM();
    $kill = $unix->find_program("kill");
    if ($unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service reloading PID {$pid} running since {$timepid}Mn...\n";
        }
        unix_system_HUP($pid);
        return;
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} not running\n";
    }
}
开发者ID:articatech,项目名称:artica,代码行数:36,代码来源:exec.freshclam.php


示例15: reload

function reload()
{
    $unix = new unix();
    $kill = $unix->find_program("kill");
    $tb = explode("\n", @file_get_contents("/var/run/fetchmail.pid"));
    $isrun = false;
    while (list($i, $pid) = each($tb)) {
        if (trim($pid) == null) {
            continue;
        }
        if (!preg_match("#([0-9]+)#", $pid, $re)) {
            continue;
        }
        $pid = $re[1];
        if (!$unix->process_exists($pid)) {
            continue;
        }
        $isrun = true;
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} reload pid {$pid}\n";
        unix_system_HUP($pid);
    }
    if (!$isrun) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} is not running, start it\n";
        start(true);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:26,代码来源:exec.fetchmail.php


示例16: build


//.........这里部分代码省略.........
    $f[] = "\tsendfile on;";
    $f[] = "\tsendfile_max_chunk 256k;";
    $f[] = "\ttcp_nopush on;";
    $f[] = "\ttcp_nodelay on;";
    $f[] = "\tserver_tokens off;";
    $dns = new resolv_conf();
    $sock = new sockets();
    if ($sock->dnsmasq_enabled()) {
        $resolver[] = "127.0.0.1";
    }
    if ($dns->MainArray["DNS1"] != null) {
        $resolver[] = $dns->MainArray["DNS1"];
    }
    if ($dns->MainArray["DNS2"] != null) {
        $resolver[] = $dns->MainArray["DNS2"];
    }
    if ($dns->MainArray["DNS3"] != null) {
        $resolver[] = $dns->MainArray["DNS3"];
    }
    $f[] = "\tresolver " . @implode(" ", $resolver) . ";";
    $f[] = "\tignore_invalid_headers on;";
    $f[] = "\tindex index.html;";
    $f[] = "\tadd_header X-CDN \"Served by myself\";";
    $q = new mysql_squid_builder();
    $sql = "SELECT * FROM nginx_caches  ORDER BY directory";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $directory = $ligne["directory"];
        @mkdir($directory, 0755, true);
        $unix->chown_func("www-data", "www-data", $directory);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: Nginx, cache `{$directory}`\n";
        }
        $f[] = "\tproxy_cache_path {$directory} levels={$ligne["levels"]} keys_zone={$ligne["keys_zone"]}:{$ligne["keys_zone_size"]}m max_size={$ligne["max_size"]}G  inactive={$ligne["inactive"]} loader_files={$ligne["loader_files"]} loader_sleep={$ligne["loader_sleep"]} loader_threshold={$ligne["loader_threshold"]};";
    }
    $f[] = "\tproxy_temp_path {$NginxProxyStorePath}/tmp/ 1 2;";
    $f[] = "\tproxy_cache_valid 404 10m;";
    $f[] = "\tproxy_cache_valid 400 501 502 503 504 1m;";
    $f[] = "\tproxy_cache_valid any 4320m;";
    $f[] = "\tproxy_cache_use_stale updating invalid_header error timeout http_404 http_500 http_502 http_503 http_504;";
    $f[] = "\tproxy_next_upstream error timeout invalid_header http_404 http_500 http_502 http_503 http_504;";
    $f[] = "\tproxy_redirect off;";
    $f[] = "\tproxy_set_header Host \$http_host;";
    $f[] = "\tproxy_set_header Server Apache;";
    $f[] = "\tproxy_set_header Connection Close;";
    $f[] = "\tproxy_pass_header Set-Cookie;";
    $f[] = "\tproxy_pass_header User-Agent;";
    $f[] = "\tproxy_set_header X-Accel-Buffering on;";
    $f[] = "\tproxy_hide_header X-CDN;";
    $f[] = "\tproxy_hide_header X-Server;";
    $f[] = "\tproxy_intercept_errors off;";
    $f[] = "\tproxy_ignore_client_abort on;";
    $f[] = "\tproxy_connect_timeout 60s;";
    $f[] = "\tproxy_send_timeout 60s;";
    $f[] = "\tproxy_read_timeout 150s;";
    $f[] = "\tproxy_buffer_size 64k;";
    $f[] = "\tproxy_buffers 16384 128k;";
    $f[] = "\tproxy_busy_buffers_size 256k;";
    $f[] = "\tproxy_temp_file_write_size 128k;";
    $f[] = "\tproxy_headers_hash_bucket_size 128;";
    $f[] = "\tproxy_cache_min_uses 0;";
    $f[] = "";
    $f[] = "{$upstreams_servers}";
    $f[] = "\tinclude /etc/nginx/sites-enabled/*.conf;";
    $f[] = "\tinclude /etc/nginx/local-sites/*.conf;";
    $f[] = "\tinclude /etc/nginx/conf.d/*.conf;";
    $f[] = "\t}";
    $f[] = $mail_protocols;
    $f[] = "";
    @copy("/etc/nginx/nginx.conf", "/etc/nginx/nginx.bak");
    @file_put_contents("/etc/nginx/nginx.conf", @implode("\n", $f));
    if (!$OnlySingle) {
        if ($GLOBALS["VERBOSE"]) {
            echo __FUNCTION__ . "." . __LINE__ . ": OK...\n";
        }
        build_progress("Building default configuration", 10);
        build_default(true);
        build_localhosts();
        if ($GLOBALS["VERBOSE"]) {
            echo __FUNCTION__ . "." . __LINE__ . ": OK...\n";
        }
    } else {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: Nginx, Only single defined\n";
        }
    }
    if ($GLOBALS["RECONFIGURE"]) {
        $pid = PID_NUM();
        if (is_numeric($pid)) {
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: Nginx, reload pid {$pid}\n";
            }
            $kill = $unix->find_program("kill");
            unix_system_HUP($pid);
        } else {
            start(true);
        }
    }
    build_progress("Building configuration done", 10);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.nginx.php


示例17: reload


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP unix_system_kill函数代码示例发布时间:2022-05-23
下一篇:
PHP units2pt函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap