本文整理汇总了PHP中sockets::Bandwidthd_enabled方法的典型用法代码示例。如果您正苦于以下问题:PHP sockets::Bandwidthd_enabled方法的具体用法?PHP sockets::Bandwidthd_enabled怎么用?PHP sockets::Bandwidthd_enabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sockets
的用法示例。
在下文中一共展示了sockets::Bandwidthd_enabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
//.........这里部分代码省略.........
$f[] = "\tstop program = \"/etc/init.d/dnsmasq stop --monit\"";
$f[] = "\tif 5 restarts within 5 cycles then timeout";
$f[] = "";
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DnsMASQ...\n";
}
@file_put_contents("/etc/monit/conf.d/APP_DNSMASQ.monitrc", @implode("\n", $f));
}
}
// ********************************************************************************************************************
$f = array();
build_progress_restart("{reconfiguring} Proftpd", 31);
@unlink("/etc/monit/conf.d/APP_PROFTPD.monitrc");
$proftpd = $unix->find_program("proftpd");
if (is_file($proftpd)) {
$enabled = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableProFTPD"));
if ($enabled == 1) {
$f[] = "check process APP_PROFTPD with pidfile /var/run/proftpd.pid";
$f[] = "\tstart program = \"/etc/init.d/proftpd start --monit\"";
$f[] = "\tstop program = \"/etc/init.d/proftpd stop --monit\"";
$f[] = "\tif 5 restarts within 5 cycles then timeout";
$f[] = "";
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DnsMASQ...\n";
}
@file_put_contents("/etc/monit/conf.d/APP_PROFTPD.monitrc", @implode("\n", $f));
}
}
// ********************************************************************************************************************
$f = array();
build_progress_restart("{reconfiguring} Bandwidthd", 31);
@unlink("/etc/monit/conf.d/APP_BANDWIDTHD.monitrc");
if (is_file("/usr/bandwidthd/bandwidthd")) {
$enabled = $sock->Bandwidthd_enabled();
if ($enabled == 1) {
$f[] = "check process APP_BANDWIDTHD with pidfile /var/run/bandwidthd.pid";
$f[] = "\tstart program = \"/etc/init.d/bandwidthd start --monit\"";
$f[] = "\tstop program = \"/etc/init.d/bandwidthd stop --monit\"";
$f[] = "\tif 5 restarts within 5 cycles then timeout";
$f[] = "";
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DnsMASQ...\n";
}
@file_put_contents("/etc/monit/conf.d/APP_BANDWIDTHD.monitrc", @implode("\n", $f));
}
}
// ********************************************************************************************************************
$f = array();
build_progress_restart("{reconfiguring} rsyslog", 32);
$rsyslogd = $unix->find_program("rsyslogd");
@unlink("/etc/monit/conf.d/APP_RSYSLOG.monitrc");
if (is_file($rsyslogd)) {
$SCRIPT = array();
$SCRIPT[] = "#!/bin/sh";
$SCRIPT[] = "{$php5} /usr/share/artica-postfix/exec.watchdog.rsyslogd.php --start";
$SCRIPT[] = "";
@file_put_contents("/bin/artica-rsyslog-start.sh", @implode("\n", $SCRIPT));
@chmod("/bin/artica-rsyslog-start.sh", 0755);
$SCRIPT = array();
$SCRIPT[] = "#!/bin/sh";
$SCRIPT[] = "{$php5} /usr/share/artica-postfix/exec.watchdog.rsyslogd.php --stop";
$SCRIPT[] = "";
@file_put_contents("/bin/artica-rsyslog-stop.sh", @implode("\n", $SCRIPT));
@chmod("/bin/artica-rsyslog-stop.sh", 0755);
$SCRIPT = array();
$f[] = "check process APP_RSYSLOG with pidfile /var/run/rsyslogd.pid";
示例2: server_status
//.........这里部分代码省略.........
$GotoOptimizeSystem = "GotoOptimizeSystem()";
$GotoDNSPerfs = "GotoDNSPerfs()";
$GotoSystemMemory = "GotoSystemMemory()";
$GotoStatsSystem = "GotoStatsSystem()";
$GotoStatsSystem_underline = "underline";
$HostTypejs_underline = "underline";
if (!$users->AsSystemAdministrator) {
$microerror_text = null;
$HostTypejs_underline = "none";
$GotoStatsSystem_underline = "none";
$HostTypejs = "blur();";
$GoToSystem = "blur()";
$GotoStatsSystem = "blur()";
$GotoSystemMemory = "blur()";
$GotoDNSPerfs = "blur()";
$GotoOptimizeSystem = "blur()";
$GotToArticaUpdate = "blur()";
$GotoBandwidthdStats = "blur()";
$GotoSpeedTests = "blur()";
}
if ($EnableBandwithCalculation == 1) {
$q = new mysql();
$sql = "SELECT * FROM speedtests ORDER BY zDate DESC LIMIT 0,1";
$speedtests = null;
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
$download = $ligne["download"];
$upload = $ligne["upload"];
$ISP = $ligne["ISP"];
//Kbi/s upload 51.2 Kbi/s
if ($download > 0) {
$speedtests = "\n\t\t\t\t<tr>\n\t\t\t\t<td> </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t<td style='font-size:16px;'>\n\t\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:{$GotoSpeedTests};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t\t{bandwidth}: <i style='font-size:16px'>{$download}Kbit/sec {download2}</i></td>\n\t\t\t\t</tr><tr>\n\t\t\t\t<td style='font-size:16px;'>\n\t\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:{$GotoSpeedTests};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t\t{bandwidth}: <i style='font-size:16px'>{$upload}Kbit/sec {upload}</a> ({$ISP})</span></i></td>\n\t\t\t\t</tr>";
}
}
if ($sock->Bandwidthd_enabled() == 1) {
$q = new mysql_squid_builder();
$bandwidthd_today = $q->COUNT_ROWS("bandwidthd_today");
if ($bandwidthd_today > 0) {
$speedtests = $speedtests . "\n\t\t\t<tr>\n\t\t\t<td style='font-size:18px;'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td valign='middle' style='width:25px'><img src='img/graph-24.png'></td>\n\t\t\t<td valign='middle'>\n\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:{$GotoBandwidthdStats};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t<span style='font-size:18px;font-weight:bold'>{$bandwidthd_today}</span> <span style='font-size:18px;'>{nodes}</span></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td>\n\t\t\t</tr>";
}
}
if ($users->AsSystemAdministrator) {
if ($EnableArticaMetaClient == 0) {
if ($ArticaAutoUpateOfficial == 1) {
$ArticaUpdateRepos = unserialize($sock->GET_INFO("ArticaUpdateRepos"));
$key_nightly = update_find_latest_nightly($ArticaUpdateRepos);
$key_offical = update_find_latest($ArticaUpdateRepos);
$OFFICIALS = $ArticaUpdateRepos["OFF"];
$Lastest = $OFFICIALS[$key_offical]["VERSION"];
$MAIN_URI = $OFFICIALS[$key_offical]["URL"];
$MAIN_MD5 = $OFFICIALS[$key_offical]["MD5"];
$MAIN_FILENAME = $OFFICIALS[$key_offical]["FILENAME"];
if ($key_offical > $CURVER_KEY) {
$err[] = "<tr><td style='font-size:18px;color:#46a346;vertical-align:middle' nowrap>\n\t\t\t\t<img src='img/32-install-soft.png' style='float:left;margin-right:10px'>\n\t\t\t\t" . texttooltip("{new_version}: {$Lastest}", "{NEW_RELEASE_TEXT}", "{$GotToArticaUpdate}") . "\n\t\t\t\t</td></tr>";
}
}
}
}
if ($EnableIntelCeleron == 1) {
$EnableIntelCeleron_explain = "<tr><td style='font-size:16px;color:#000000;vertical-align:middle' nowrap>\n\t\t\t\t<i>" . texttooltip("{CELERON_METHOD}", "{CELERON_METHOD_EXPLAIN}", $GotoOptimizeSystem) . "</i>\n\t\t\t\t</td></tr>";
}
$EnableDNSPerfs = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableDNSPerfs"));
if ($EnableDNSPerfs == 1) {
if ($EnableIntelCeleron == 0) {
$DNS_COLOR = "black;";
if ($DashBoardDNSPerfsStats != null) {
$DashBoardDNSPerfsStats = round($DashBoardDNSPerfsStats, 2);
示例3: start
function start($aspid = false)
{
$unix = new unix();
$sock = new sockets();
$Masterbin = "/usr/bandwidthd/bandwidthd";
if (!is_file($Masterbin)) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, arpd 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();
if ($unix->MEM_TOTAL_INSTALLEE() < 624288) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} not enough memory\n";
}
if ($unix->process_exists($pid)) {
stop();
}
return;
}
if ($unix->process_exists($pid)) {
$timepid = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Service already started {$pid} since {$timepid}Mn...\n";
}
return;
}
$EnableDaemon = intval($sock->Bandwidthd_enabled());
if ($EnableDaemon == 0) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service disabled (see EnableBandwidthd)\n";
}
return;
}
$php5 = $unix->LOCATE_PHP5_BIN();
$sysctl = $unix->find_program("sysctl");
$echo = $unix->find_program("echo");
$nohup = $unix->find_program("nohup");
build();
$cmd = "{$nohup} {$Masterbin} >/dev/null 2>&1 &";
@unlink("/var/run/bandwidthd.pid");
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service\n";
}
shell_exec($cmd);
for ($i = 1; $i < 5; $i++) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} waiting {$i}/5\n";
}
sleep(1);
$pid = PID_NUM();
if ($unix->process_exists($pid)) {
break;
}
}
$pid = PID_NUM();
if ($unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Success PID {$pid}\n";
}
} else {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Failed\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} {$cmd}\n";
}
}
}