本文整理汇总了PHP中unix_system_kill_force函数的典型用法代码示例。如果您正苦于以下问题:PHP unix_system_kill_force函数的具体用法?PHP unix_system_kill_force怎么用?PHP unix_system_kill_force使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unix_system_kill_force函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: parse
function parse()
{
$TimeFile = "/etc/artica-postfix/pids/exec.squid.stats.mime.proto.php.time";
$pidfile = "/etc/artica-postfix/pids/exec.squid.stats.mime.proto.php.pid";
$GLOBALS["LogFileDeamonLogDir"] = @file_get_contents("/etc/artica-postfix/settings/Daemons/LogFileDeamonLogDir");
if ($GLOBALS["LogFileDeamonLogDir"] == null) {
$GLOBALS["LogFileDeamonLogDir"] = "/home/artica/squid/realtime-events";
}
$unix = new unix();
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$timepid = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["VERBOSE"]) {
echo "{$pid} already executed since {$timepid}Mn\n";
}
if ($timepid < 14) {
return;
}
$kill = $unix->find_program("kill");
unix_system_kill_force($pid);
}
@file_put_contents($pidfile, getmypid());
$TimeExec = $unix->file_time_min($TimeFile);
if (!$GLOBALS["FORCE"]) {
if ($TimeExec < 20) {
return;
}
}
@unlink($TimeFile);
@file_put_contents($TimeFile, time());
parsedb("/var/log/squid");
parsedb($GLOBALS["LogFileDeamonLogDir"]);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:33,代码来源:exec.squid.stats.proto.parser.php
示例2: start_hour
function start_hour()
{
$TimeFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$unix = new unix();
$sock = new sockets();
if (system_is_overloaded(basename(__FILE__))) {
return;
}
$pid = @file_get_contents($pidfile);
if ($pid < 100) {
$pid = null;
}
if ($unix->process_exists($pid, basename(__FILE__))) {
$timepid = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["VERBOSE"]) {
echo "{$pid} already executed since {$timepid}Mn\n";
}
if (!$GLOBALS["FORCE"]) {
if ($timepid < 14) {
return;
}
$kill = $unix->find_program("kill");
unix_system_kill_force($pid);
}
}
@unlink($TimeFile);
@file_put_contents($TimeFile, time());
$hostname = $unix->hostname_g();
$today = date("Y-m-d") . " 00:00:00";
$postgres = new postgres_sql();
$results = $postgres->QUERY_SQL("select date_trunc('H',zdate) + (round(extract('minute' from zdate)/15)*15) * '1 minute'::interval as time, sum(rx) as rx, sum(tx) as tx,eth from access_log WHERE proxyname='{$hostname}' AND zdate >'{$today}' group by time,eth");
$c = 0;
$f = array();
while ($ligne = @pg_fetch_assoc($results)) {
$time = $ligne["time"];
$ETH = $ligne["eth"];
if ($ETH == "lo") {
continue;
}
$RX = $ligne["rx"];
$TX = $ligne["tx"];
$f[] = "('{$time}','{$ETH}','{$RX}','{$TX}')";
}
if (count($f) == 0) {
return;
}
$q = new mysql();
if ($q->TABLE_EXISTS("RXTX_HOUR", "artica_events")) {
$q->QUERY_SQL("TRUNCATE TABLE `RXTX_HOUR`", "artica_events");
}
$sql = "CREATE TABLE IF NOT EXISTS `RXTX_HOUR`\n\t(`ZDATE` DATETIME,\n\t`RX` INT UNSIGNED NOT NULL DEFAULT 1,\n\t`TX` INT UNSIGNED NOT NULL DEFAULT 1,\n\t`ETH` VARCHAR(60),\n\tKEY `ZDATE`(`ZDATE`),\n\tKEY `RX`(`RX`),\n\tKEY `TX`(`TX`),\n\tKEY `ETH`(`ETH`) ) ENGINE = MYISAM;";
$q->QUERY_SQL($sql, "artica_events");
if (!$q->ok) {
return;
}
$q->QUERY_SQL("INSERT IGNORE INTO RXTX_HOUR (ZDATE,ETH,RX,TX) VALUES " . @implode(",", $f), "artica_events");
start_week();
}
开发者ID:articatech,项目名称:artica,代码行数:59,代码来源:exec.rxtx.hourly.php
示例3: ScanFoldders
function ScanFoldders()
{
$sock = new sockets();
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$pid = file_get_contents("{$pidfile}");
if ($GLOBALS["VERBOSE"]) {
echo "{$timefile}\n";
}
if (system_is_overloaded(basename(__FILE__))) {
die;
}
if ($unix->process_exists($pid, basename(__FILE__))) {
$timeMin = $unix->PROCCESS_TIME_MIN($pid);
if ($timeMin > 240) {
system_admin_events("Too many TTL, {$pid} will be killed", __FUNCTION__, __FILE__, __LINE__, "logrotate");
$kill = $unix->find_program("kill");
unix_system_kill_force($pid);
} else {
die;
}
}
if (!$GLOBALS["FORCE"]) {
$TimeExec = $unix->file_time_min($timefile);
if ($TimeExec < 240) {
return;
}
}
@unlink($timefile);
@file_put_contents($timefile, time());
$LogRotatePath = $sock->GET_INFO("LogRotatePath");
$SystemLogsPath = $sock->GET_INFO("SystemLogsPath");
$BackupMaxDaysDir = $sock->GET_INFO("BackupMaxDaysDir");
$maillogStoragePath = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/maillogStoragePath"));
if ($GLOBALS["VERBOSE"]) {
echo "Starting Main\n";
}
$q = new mysql();
$q->QUERY_SQL("DROP TABLE `sysstorestatus`", "artica_events");
$sql = "CREATE TABLE IF NOT EXISTS `sysstorestatus` (\n\t\t\t `filepath` VARCHAR(255) NOT NULL,\n\t\t\t `filesize` BIGINT UNSIGNED NOT NULL,\n\t\t\t `zDate` DATETIME,\n\t\t\t PRIMARY KEY (`filepath`),\n\t\t\t KEY `zDate` (`zDate`),\n\t\t\t KEY `filesize` (`filesize`)\n\t\t\n\t\t\t)";
$q->QUERY_SQL($sql, "artica_events");
if (!$q->ok) {
echo $q->mysql_error;
return;
}
ScanThis("/home/postfix/maillog");
ScanThis("/home/logrotate");
ScanThis("/home/logrotate_backup");
ScanThis("/home/logs-backup");
ScanThis("/home/backup/postfix");
ScanThis($LogRotatePath);
ScanThis($SystemLogsPath);
ScanThis($maillogStoragePath);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:55,代码来源:exec.scan.storage-logs.php
示例4: ParseMainDir
function ParseMainDir()
{
$unix = new unix();
$mypid = getmypid();
$kill = $unix->find_program("kill");
$nohup = $unix->find_program("nohup");
$php5 = $unix->LOCATE_PHP5_BIN();
@mkdir("/etc/artica-postfix/pids", 0755, true);
$pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
$pidtime_hour = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".hours.time";
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$pid = @file_get_contents($pidfile);
if ($pid < 100) {
$pid = null;
}
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($time > 60) {
unix_system_kill_force($pid);
} else {
events("Already executed pid {$pid} since {$time}mn-> DIE");
if ($GLOBALS["VERBOSE"]) {
echo "Already executed pid {$pid} since {$time}mn\n";
}
die;
}
}
$timeP = $unix->file_time_min($pidtime);
if ($timeP < 3) {
events("Main::Line: " . __LINE__ . " 3Mn minimal current: {$timeP}mn-> DIE");
die;
}
@unlink($pidtime);
@file_put_contents($pidtime, time());
@file_put_contents($pidfile, $mypid);
$dirs = $unix->dirdir("/var/log/artica-postfix/squid/queues");
while (list($directory, $array) = each($dirs)) {
$dirs2 = $unix->dirdir($directory);
if (count($dirs2) == 0) {
events("{$dirs2} 0 elements, remove...", __LINE__);
@rmdir($directory);
continue;
}
if (is_dir("{$directory}/SearchWords")) {
events("Scanning {$directory}/SearchWords", __LINE__);
ParseSubDir("{$directory}/SearchWords");
}
}
$timeP = $unix->file_time_min($pidtime_hour);
if ($timeP > 30) {
@unlink($pidtime_hour);
@file_put_contents($pidtime_hour, time());
shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.squid-searchwords.php --hour >/dev/null 2>&1");
}
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:55,代码来源:exec.squid.words.parsers.php
示例5: parse
function parse()
{
$TimeFile = "/etc/artica-postfix/pids/exec.squid.stats.quota-week.parser.php.time";
$pidfile = "/etc/artica-postfix/pids/exec.squid.stats.quota-week.parser.php.pid";
$unix = new unix();
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$timepid = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["VERBOSE"]) {
echo "{$pid} already executed since {$timepid}Mn\n";
}
if ($timepid < 14) {
return;
}
$kill = $unix->find_program("kill");
unix_system_kill_force($pid);
}
@file_put_contents($pidfile, getmypid());
$sock = new sockets();
$SquidPerformance = intval($sock->GET_INFO("SquidPerformance"));
$time = $unix->file_time_min($TimeFile);
if (!$GLOBALS["FORCE"]) {
if ($time < 1440) {
return;
}
}
@unlink($TimeFile);
@file_put_contents($TimeFile, time());
$f = $unix->DirFiles("/var/log/squid", "[0-9]+_QUOTASIZE\\.db");
$export_path = "/home/artica/squid/dbExport";
@mkdir($export_path, 0755, true);
while (list($filename, $none) = each($f)) {
preg_match("#([0-9]+)_#", $filename, $re);
$xdate = $re[1];
echo "{$filename} ( {$xdate} )\n";
if ($SquidPerformance > 1) {
if (!@copy("/var/log/squid/{$filename}", "{$export_path}/{$filename}")) {
continue;
}
@unlink("/var/log/squid/{$filename}");
continue;
}
if (!parse_file("/var/log/squid/{$filename}", $xdate)) {
continue;
}
if (!@copy("/var/log/squid/{$filename}", "{$export_path}/{$filename}")) {
continue;
}
@unlink("/var/log/squid/{$filename}");
}
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:51,代码来源:exec.squid.stats.quota-week.parser.php
示例6: watchdog
function watchdog($maxProcesses = 50)
{
$unix = new unix();
$pdns_server = $unix->find_program("pdns_server");
$pdns_recursor = $unix->find_program("pdns_recursor");
$pidof = $unix->find_program("pidof");
$kill = $unix->find_program("kill");
echo "pdns_server = {$pdns_server}\n";
echo "pdns_recursor = {$pdns_recursor}\n";
exec("{$pidof} {$pdns_server} 2>&1", $results);
$string = @implode("", $results);
$exploded = @explode(" ", $string);
while (list($num, $val) = each($exploded)) {
if (!is_numeric($val)) {
echo "skip {$val}\n";
continue;
}
$PIDS[$val] = $val;
}
echo count($PIDS) . " processes <> {$maxProcesses} for {$pdns_server}\n";
if (count($PIDS) > $maxProcesses) {
echo "Watchdog GO -> kill {$pdns_server} !\n";
while (list($num, $int) = each($PIDS)) {
echo "Killing {$pdns_server} pid {$num}\n";
unix_system_kill_force($num);
}
$PIDS = array();
exec("{$pidof} {$pdns_recursor} 2>&1", $results);
$string = @implode("", $results);
$exploded = @explode(" ", $string);
while (list($num, $val) = each($exploded)) {
if (!is_numeric($val)) {
continue;
}
$PIDS[$val] = $val;
}
echo count($PIDS) . " processes <> {$maxProcesses} for {$pdns_recursor}\n";
while (list($num, $int) = each($PIDS)) {
echo "Killing {$pdns_recursor} pid {$num} \n";
unix_system_kill_force($num);
}
}
echo "Finish\n";
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:44,代码来源:exec.powerdns.watchdog.php
示例7: start
function start()
{
// /etc/artica-postfix/pids/exec.loadavg.php.start.time
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pidfileTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
if ($GLOBALS["VERBOSE"]) {
echo "{$pidfileTime}\n";
}
if (!$GLOBALS["VERBOSE"]) {
if ($unix->file_time_min($pidfileTime) < 59) {
return;
}
}
$pid = @file_get_contents($pidfile);
if ($pid < 100) {
$pid = null;
}
if ($unix->process_exists($pid, basename(__FILE__))) {
$timepid = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["VERBOSE"]) {
echo "{$pid} already executed since {$timepid}Mn\n";
}
if ($timepid < 15) {
return;
}
$kill = $unix->find_program("kill");
unix_system_kill_force($pid);
}
@file_put_contents($pidfile, getmypid());
if (system_is_overloaded()) {
if ($GLOBALS["VERBOSE"]) {
echo "Overloaded\n";
}
die;
}
@unlink($pidfileTime);
@file_put_contents($pidfileTime, time());
if ($GLOBALS["VERBOSE"]) {
echo "cpustats\n";
}
cpustats();
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:43,代码来源:exec.loadavg.php
示例8: stop
function stop($id)
{
$unix = new unix();
$sql = "SELECT * FROM imapsync WHERE ID='{$id}'";
$q = new mysql();
$ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
if (!$q->ok) {
write_syslog("Mysql error {$q->mysql_error}", __FILE__);
die;
}
$pid_org = $ligne["pid"];
$ligne["imap_server"] = str_replace(".", "\\.", $ligne["imap_server"]);
$ligne["username"] = str_replace(".", "\\.", $ligne["username"]);
exec($unix->find_program("pgrep") . " -f \"imapsync.+?--host1 {$ligne["imap_server"]}.+?--user1 {$ligne["username"]}\"", $pids);
while (list($index, $pid) = each($pids)) {
if ($pid > 5) {
unix_system_kill_force($pid);
}
}
unix_system_kill_force($pid_org);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:21,代码来源:exec.mailsync.php
示例9: run
function run()
{
$TimeFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$unix = new unix();
$tmpfile = $unix->FILE_TEMP();
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$timepid = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["VERBOSE"]) {
echo "{$pid} already executed since {$timepid}Mn\n";
}
if (!$GLOBALS["FORCE"]) {
if ($timepid < 14) {
return;
}
$kill = $unix->find_program("kill");
unix_system_kill_force($pid);
}
}
@file_put_contents($pidfile, getmypid());
if (!$GLOBALS["FORCE"]) {
if (!$GLOBALS["VERBOSE"]) {
$time = $unix->file_time_min($TimeFile);
if ($time < 14) {
echo "Current {$time}Mn, require at least 14mn\n";
return;
}
}
}
$binary = "/usr/share/artica-postfix/bin/pflogsumm.pl";
@chmod("{$binary}", 0755);
system("{$binary} -d today /var/log/mail.log >{$tmpfile}");
ParseReport($tmpfile);
@unlink($tmpfile);
stats_total();
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:37,代码来源:exec.pflogsumm.php
示例10: stop
function stop($aspid = false)
{
$unix = new unix();
$kill = $unix->find_program("kill");
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 "Stopping......: " . date("H:i:s") . " [INIT]: nginx-tail, Already task running PID {$pid} since {$time}mn\n";
}
return;
}
@file_put_contents($pidfile, getmypid());
}
$pid = GETPID();
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: nginx-tail, already stopped\n";
}
return;
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: nginx-tail, stopping pid: {$pid}\n";
}
unix_system_kill_force($pid);
for ($i = 0; $i < 6; $i++) {
$pid = GETPID();
if (!$unix->process_exists($pid)) {
break;
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: nginx-tail, waiting pid: {$pid} {$i}/5\n";
}
unix_system_kill_force($pid);
sleep(1);
}
$tail = $unix->find_program("tail");
$pid = $unix->PIDOF("/bin/nginx-tail");
if ($unix->process_exists($pid)) {
for ($i = 0; $i < 20; $i++) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: killing old process pid {$pid}\n";
}
unix_system_kill_force($pid);
usleep(800);
$pid = $unix->PIDOF("/bin/access-tail");
if (!$unix->process_exists($pid)) {
break;
}
unix_system_kill_force($pid);
}
}
$pid = GETPID();
if (!$unix->process_exists($pid)) {
events("exec.init-tail-nginx.phpp success to stop daemon...");
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: nginx-tail, success\n";
}
} else {
events("exec.init-tail-nginx.php failed to stop daemon...");
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: nginx-tail, failed\n";
}
}
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:67,代码来源:exec.init-tail-nginx.php
示例11: MultiplesInstances_stop
function MultiplesInstances_stop($hostname)
{
$unix = new unix();
$pid = MultiplesInstancesPID($hostname);
if (!$unix->process_exists($pid)) {
echo "{$GLOBALS["deflog_sstop"]} {$hostname} already stopped\n";
return;
}
echo "{$GLOBALS["deflog_sstop"]} {$hostname} stopping pid {$pid}\n";
unix_system_kill($pid);
for ($i = 0; $i < 20; $i++) {
$pid = MultiplesInstancesPID($hostname);
if (!$unix->process_exists($pid)) {
echo "{$GLOBALS["deflog_sstop"]} {$hostname} stopped\n";
break;
}
echo "{$GLOBALS["deflog_sstop"]} {$hostname} waiting pid {$pid}\n";
if ($unix->process_exists($pid)) {
unix_system_kill_force($pid);
sleep(1);
continue;
}
break;
}
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:25,代码来源:exec.milter-greylist.php
示例12: GetInstances
function GetInstances()
{
$unix = new unix();
$pidsARR = array();
$kill = $unix->find_program("kill");
$pgrep = $unix->find_program("pgrep");
exec("{$pgrep} -l -f \"python.*?tespeed\\.py\" 2>&1", $results);
while (list($index, $line) = each($results)) {
if (!preg_match("#([0-9]+)\\s+(.*?)#", $line, $re)) {
continue;
}
$pid = $re[1];
$cmdline = trim($re[2]);
if (preg_match("#^sh\\s+#", $cmdline)) {
continue;
}
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($time > 15) {
unix_system_kill_force($pid);
continue;
}
$pidsARR[$pid] = true;
}
if ($GLOBALS["VERBOSE"]) {
echo "-> " . count($pidsARR) . " instances..\n";
}
return count($pidsARR);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:28,代码来源:exec.testspeed.php
示例13: stop
function stop($aspid = false)
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
if (!$aspid) {
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: Already task running PID {$pid} since {$time}mn\n";
}
return;
}
}
@file_put_contents($pidfile, getmypid());
$pid = ZARAFA_SEARCH_PID();
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} already stopped...\n";
}
return;
}
if (is_file("/tmp/zarafa-upgrade-lock")) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} database upgrade is taking place.\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: Do not stop this process bacause it may render your database unusable..\n";
}
return;
}
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Daemon with a ttl of {$time}mn\n";
}
$kill = $unix->find_program("kill");
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} killing smoothly PID {$pid}...\n";
}
unix_system_kill($pid);
sleep(1);
for ($i = 1; $i < 5; $i++) {
$pid = ZARAFA_SEARCH_PID();
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} pid {$pid} successfully stopped ...\n";
}
break;
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} wait pid {$pid} {$i}/5\n";
}
sleep(1);
}
$pid = ZARAFA_SEARCH_PID();
if ($unix->process_exists($pid)) {
unix_system_kill_force($pid);
sleep(1);
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} force killing {$pid}...\n";
}
for ($i = 1; $i < 5; $i++) {
$pid = ZARAFA_SEARCH_PID();
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} pid {$pid} successfully stopped ...\n";
}
break;
}
unix_system_kill_force($pid);
sleep(1);
}
}
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} daemon success...\n";
}
return;
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} daemon failed...\n";
}
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:83,代码来源:exec.zarafa-search.php
示例14: xstart
function xstart()
{
$unix = new unix();
$TimeFile = "/etc/artica-postfix/pids/exec.squidcache.php.time";
$PidFile = "/etc/artica-postfix/pids/exec.squidcache.php.pid";
$Pid = $unix->get_pid_from_file($PidFile);
if ($unix->process_exists($Pid)) {
$pidtime = $unix->PROCCESS_TIME_MIN($Pid);
if ($pidtime > 29) {
events("Max execution time reached 30Mn for PID {$Pid} Kill it...", 0, 2, __LINE__);
unix_system_kill_force($Pid);
die;
}
events("Already running PID {$Pid} since {$pidtime}Mn", 0, 2, __LINE__);
return;
}
@file_put_contents($PidFile, getmypid());
$pids = $unix->PIDOF_PATTERN_ALL(basename(__FILE__));
if (count($pids) > 3) {
events("Too many instances " . count($pids) . " dying", 0, 1, __LINE__);
$mypid = getmypid();
while (list($pid, $ligne) = each($pids)) {
if ($pid == $mypid) {
continue;
}
events("Killing {$pid}");
unix_system_kill_force($pid);
}
}
$pids = $unix->PIDOF_PATTERN_ALL(basename(__FILE__));
if (count($pids) > 3) {
events("Too many instances " . count($pids) . " dying", 0, 2, __LINE__);
die;
}
@unlink($TimeFile);
@file_put_contents($TimeFile, time());
$sock = new sockets();
$GLOBALS["HyperCacheStoragePath"] = $sock->GET_INFO("HyperCacheStoragePath");
if ($GLOBALS["HyperCacheStoragePath"] == null) {
$GLOBALS["HyperCacheStoragePath"] = "/home/artica/proxy-cache";
}
@chown("/usr/share/squid3", "squid");
@chgrp("/usr/share/squid3", "squid");
HyperCacheMirror();
if ($GLOBALS["HYPER_CACHE_VERBOSE"]) {
events("Storage path: {$GLOBALS["HyperCacheStoragePath"]}", 0, 2, __LINE__);
events("Scanning /usr/share/squid3", 0, 2, __LINE__);
}
$f = $unix->DirFiles("/usr/share/squid3", "HyperCacheQueue-.+?-([0-9]+)\\.db\$");
$GLOBALS["SIZE_DOWNLOADED"] = 0;
$GLOBALS["HITS"] = 0;
while (list($num, $file) = each($f)) {
if ($GLOBALS["HYPER_CACHE_VERBOSE"]) {
events("Found database: {$file}", 0, 2, __LINE__);
}
if (!preg_match("#^HyperCacheQueue-.+?-([0-9]+)\\.db\$#", $file, $re)) {
continue;
}
if (preg_match("#HyperCacheQueue-dropbox\\.com#", $file)) {
continue;
}
$ID = $re[1];
HyperCacheScanDBFile("/usr/share/squid3/{$file}", $ID);
}
if ($GLOBALS["SIZE_DOWNLOADED"] > 0) {
$size = FormatBytes($GLOBALS["SIZE_DOWNLOADED"] / 1024);
$hits = $GLOBALS["HITS"];
events("{$size} downloaded - {$hits} requests", $ID, 2, __LINE__);
squid_admin_enforce(2, "{$size} downloaded and store {$hits} requests", null, __FILE__, __LINE__);
}
if ($GLOBALS["VERBOSE"]) {
echo "xstart ---> DeleteRules\n";
}
DeleteRules();
if ($GLOBALS["VERBOSE"]) {
echo "xstart ---> GetRulesSizes\n";
}
GetRulesSizes();
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:79,代码来源:exec.squidcache.php
示例15: stop
function stop()
{
$SERV_NAME = $GLOBALS["SERV_NAME"];
$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 "Stopping......: " . date("H:i:s") . " [INIT]:{$SERV_NAME} Already task running PID {$pid} since {$time}mn\n";
}
return;
}
@file_put_contents($pidfile, getmypid());
$pid = RSYNC_PID();
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$SERV_NAME} already stopped...\n";
}
return;
}
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$SERV_NAME} with a ttl of {$time}mn\n";
}
$MirrorDebianDir = $GLOBALS["CLASS_SOCKETS"]->GET_INFO("MirrorDebianDir");
if ($MirrorDebianDir == null) {
$MirrorDebianDir = "/home/mirrors/Debian";
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$SERV_NAME} with a mirror located in \"{$MirrorDebianDir}\"\n";
}
$kill = $unix->find_program("kill");
for ($i = 0; $i < 10; $i++) {
$pid = RSYNC_PID();
if ($unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$SERV_NAME} kill pid {$pid}..\n";
}
unix_system_kill_force($pid);
} else {
break;
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$SERV_NAME} wait {$i}/10\n";
}
sleep(1);
}
$pid = RSYNC_PID();
if (!$unix->process_exists($pid)) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$SERV_NAME} success...\n";
}
return;
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$SERV_NAME} Failed...\n";
}
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:59,代码来源:exec.debian.mirror.php
示例16: ScanPurgeexc
function ScanPurgeexc()
{
$unix = new unix();
$purge = $unix->find_program("purge");
$pidof = $unix->find_program("pidof");
$kill = $unix->find_program("kill");
exec("{$pidof} {$purge} 2>&1", $results);
$pp = array();
$pids = explode(" ", @implode("", $results));
while (list($index, $pid) = each($pids)) {
if (!is_numeric(trim($pid))) {
continue;
}
$pp[] = $pid;
}
$count = count($pp);
if ($count > 1) {
unset($pp[0]);
while (list($index, $pid) = each($pp)) {
unix_system_kill_force($pid);
}
}
$count = count($pp);
return $count;
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:25,代码来源:exec.squid.purge.php
示例17: buildinit
if ($argv[1] == "--initd") {
buildinit();
die;
}
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
echo "Starting......: " . date("H:i:s") . " hamachi already executed PID: {$pid} since {$time}Mn\n";
writelogs("hamachi already executed PID: {$pid}", "MAIN", __FUNCTION__, __FILE__, __LINE__);
if (!$GLOBALS["FORCE"]) {
die;
}
$kill = $unix->find_program("kill");
unix_system_kill_force($pid);
}
@file_put_contents($pidfile, getmypid());
main();
function main()
{
$sock = new sockets();
$unix = new unix();
$users = new usersMenus();
if (!$users->HAMACHI_INSTALLED) {
echo "Starting......: " . date("H:i:s") . " hamachi not installed\n";
die;
}
if (!isset($GLOBALS["hamachi_bin"])) {
$GLOBALS["hamachi_bin"] = $unix->find_program("hamachi");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.hamachi.php
示例18: killbyports
function killbyports()
{
$sock = new sockets();
$unix = new unix();
$kill = $unix->find_program("kill");
$ufdbguardConfig = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig")));
if (!isset($datas["listen_addr"])) {
$datas["listen_addr"] = "127.0.0.1";
}
if (!isset($datas["listen_port"])) {
$datas["listen_port"] = "3977";
}
if (!isset($datas["tcpsockets"])) {
$datas["tcpsockets"] = 0;
}
if ($datas["listen_addr"] == null) {
$datas["listen_addr"] = "127.0.0.1";
}
if (!is_numeric($datas["listen_port"])) {
$datas["listen_port"] = "3977";
}
if ($datas["tcpsockets"] == 0) {
return 1;
}
$PIDS = $unix->PIDOF_BY_PORT($datas["listen_port"]);
if (count($PIDS) == 0) {
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} 0 PID listens {$datas["listen_port"]}...\n";
}
return;
}
while (list($pid, $b) = each($PIDS)) {
if ($unix->process_exists($pid)) {
$cmdline = @file_get_contents("/proc/{$pid}/cmdline");
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} killing PID {$pid} that listens {$datas["listen_port"]} TCP port\n";
}
if ($GLOBALS["OUTPUT"]) {
echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} {$cmdline}\n";
}
unix_system_kill_force($pid);
}
}
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:44,代码来源:exec.ufdb.php
示例19: SERVICE_START
function SERVICE_START($nochecks = false, $nopid = false)
{
$unix = new unix();
$sock = new sockets();
$kill = $unix->find_program("kill");
if (!$nopid) {
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
echo "Starting......: " . date("H:i:s") . " MySQL this script is already executed PID: {$pid} since {$time}Mn\n";
if ($time < 5) {
if (!$GLOBALS["FORCE"]) {
return;
}
}
unix_system_kill_force($pid);
}
@file_put_contents($pidfile, getmypid());
}
if (is_file("/etc/artica-postfix/mysql.stop")) {
echo "Starting......: " . date("H:i:s") . " MySQL locked, exiting\n";
return;
}
$PID_NUM = PID_NUM();
if ($unix->process_exists($PID_NUM)) {
$timemin = $unix->PROCCESS_TIME_MIN($PID_NUM);
echo "Starting......: " . date("H:i:s") . " MySQL already running PID \"{$PID_NUM}\" since {$timemin}Mn\n";
return;
}
$mysql_install_db = $unix->find_program('mysql_install_db');
$mysqlbin = $unix->LOCATE_mysqld_bin();
$php5 = $unix->LOCATE_PHP5_BIN();
$nohup = $unix->find_program("nohup");
if (!is_file($mysqlbin)) {
echo "Starting......: " . date("H:i:s") . " MySQL is not installed, abort\n";
return;
}
$EnableMysqlFeatures = $sock->GET_INFO('EnableMysqlFeatures');
$MysqlBinAllAdresses = $sock->GET_INFO('MysqlBinAllAdresses');
$MySQLTMPMEMSIZE = $sock->GET_INFO('MySQLTMPMEMSIZE');
$MysqlTooManyConnections = $sock->GET_INFO("MysqlTooManyConnections");
$MysqlRemoveidbLogs = $sock->GET_INFO("MysqlRemoveidbLogs");
$innodb_force_recovery = $sock->GET_INFO("innodb_force_recovery");
if (!is_numeric($innodb_force_recovery)) {
$innodb_force_recovery = 0;
}
if (!is_numeric($MysqlRemoveidbLogs)) {
$MysqlRemoveidbLogs = 0;
}
if (!is_numeric($MysqlBinAllAdresses)) {
$MysqlBinAllAdresses = 0;
}
if (!is_numeric($MySQLTMPMEMSIZE)) {
$MySQLTMPMEMSIZE = 0;
}
if (!is_numeric($MysqlTooManyConnections)) {
$MysqlTooManyConnections = 0;
}
if (!is_numeric($EnableMysqlFeatures)) {
$EnableMysqlFeatures = 1;
}
$MySqlTmpDir = $sock->GET_INFO('MySQLTMPDIR');
$MySQLLOgErrorPath = $sock->GET_INFO('MySQLLOgErrorPath');
$datadir = $unix->MYSQL_DATA_DIR();
$EnableMysqlLog = $sock->GET_INFO("EnableMysqlLog&qu
|
请发表评论