function action_stop() { global $config, $status; if (!$status) { return false; } spawnProcess($config['stop_cmd']); $status = is_running(); return "Stop executed"; }
function ses() { echo 'Start Notification' . PHP_EOL; $this->load->library('lib_feedback'); if (is_running() === FALSE) { lock(); while (TRUE) { if (is_null($this->lib_feedback->process_notification())) { show_error($this->lib_feedback->get_error_message()); } } unlock(); } }
function action_stop() { global $config, $status; if (!$status) { return false; } if (isWin()) { $command = 'taskkill /F /pid ' . $status['PID']; } else { $command = $config['stop_cmd']; } spawnProcess($command); $status = is_running(); return "Stop executed"; }
function campaign($count = 99) { echo 'Start Campaign' . PHP_EOL; if (is_running() === FALSE) { lock(); while (TRUE) { $campaign_message = $this->lib_request_scheduled->get_latest_campaign(); if (empty($campaign_message)) { echo 'No task found!' . PHP_EOL; break; } if (is_null($this->lib_request_scheduled->process_campaign($campaign_message, $count))) { show_error($this->lib_request_scheduled->get_error_message()); } } unlock(); } }
function send($count = 9) { echo 'Start send' . PHP_EOL; $this->load->library('lib_archive'); if (is_running() === FALSE) { lock(); while (TRUE) { $messages = $this->lib_archive->get_unsent($count); if (empty($messages)) { echo 'No task found!' . PHP_EOL; break; } if (is_null($this->lib_archive->send($messages))) { show_error($this->lib_archive->get_error_message()); } } unlock(); } }
$lines = file($arg2 . $logfile); foreach ($lines as $chkline) { if (strpos($chkline, 'All OK') !== FALSE) { echo 'File has successfully been extracted!'; if (file_exists($arg2 . $logfile)) { del($arg2 . $logfile); } } } } } // unzip if (strcasecmp('zip', $arg3) == 0) { if (file_exists($arg2 . $logfile)) { del($arg2 . $logfile); } $Command = escapeshellarg($arg4) . ' ' . escapeshellarg($arg1) . ' -d ' . escapeshellarg($arg2); $unzippid = shell_exec("nohup {$Command} > " . escapeshellarg($arg2 . $logfile) . " 2>&1 & echo \$!"); echo 'Uncompressing file...<BR>PID is: ' . $unzippid . '<BR>'; while (is_running($unzippid)) { /* occupy time to cause popup window load bar to load in conjunction with unzip progress */ } } //debug: echo variables if (strcasecmp('debug', $arg3) == 0) { echo $arg1 . '<BR>'; echo $arg2 . '<BR>'; echo $arg3 . '<BR>'; echo $arg4 . '<BR>'; echo $arg5 . '<BR>'; }
for ($i = 0; $i < $rows_cnt; $i++) { if ($OJ_MEMCACHE) { $row = $result[$i]; } else { $row = mysql_fetch_array($result); } if ($top == -1) { $top = $row['solution_id']; } $bottom = $row['solution_id']; if ($cnt) { echo "<tr align=center class='oddrow'>"; } else { echo "<tr align=center class='evenrow'>"; } $flag = !is_running(intval($row['contest_id'])) || isset($_SESSION['source_browser']) || isset($_SESSION['administrator']) || isset($_SESSION['user_id']) && !strcmp($row['user_id'], $_SESSION['user_id']); $cnt = 1 - $cnt; echo "<td>" . $row['solution_id']; echo "<td><a href='userinfo.php?user="******"'>" . $row['user_id'] . "</a>"; if ($row['contest_id'] > 0) { echo "<td><a href='problem.php?cid=" . $row['contest_id'] . "&pid=" . $row['num'] . "'>"; if (isset($cid)) { echo $PID[$row['num']] . "</a>"; } else { echo $row['problem_id'] . "</a>"; } } else { echo "<td><a href='problem.php?id=" . $row['problem_id'] . "'>" . $row['problem_id'] . "</a>"; } if (intval($row['result']) == 11 && (isset($_SESSION['user_id']) && $row['user_id'] == $_SESSION['user_id'] || isset($_SESSION['source_browser']))) { echo "<td><a href='ceinfo.php?sid=" . $row['solution_id'] . "' class=" . $judge_color[$row['result']] . ">" . $judge_result[$row['result']] . "</a>";
} ossim_valid($delete, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("delete")); ossim_valid($status, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("status")); ossim_valid($restart, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("restart")); if (ossim_error()) { echo _("You must fill all inputs"); } else { require_once 'ossim_conf.inc'; $ossim_conf = $GLOBALS["CONF"]; $main_ip = $ossim_conf->get_conf("frameworkd_address"); $nfsen_sensors = get_nfsen_sensors(); if ($delete) { if ($nfsen_sensors[$name] != "") { unset($nfsen_sensors[$name]); set_nfsen_sensors($nfsen_sensors); nfsen_reset($nfsen_dir); echo str_replace("IP", $ip, _("IP now is not configured as a Flow collector")); } } elseif ($status) { is_running($name); } elseif ($restart) { nfsen_start(); } else { $nfsen_sensors[$name]['port'] = $port; $nfsen_sensors[$name]['color'] = $color; $nfsen_sensors[$name]['type'] = $type; set_nfsen_sensors($nfsen_sensors); nfsen_reset(); echo str_replace("IP", $main_ip, str_replace("PORT", $port, _("You should now configure your Flows generator to send Flows to IP port PORT. A new exception must be created in AlienVault firewall"))); } }
sendErrorEmail("cron.php: oci_parse select email_address, process_id, file_name from vocab_download.vocabulary_user where file_creation_job_running_flag = 'Y' failed, error message=" . $e['message']); die; } $returnvalue = oci_execute($stid_user_process); if (!$returnvalue) { $e = oci_error($stid); sendErrorEmail("cron.php: oci_execute select email_address, process_id, file_name from vocab_download.vocabulary_user where file_creation_job_running_flag = 'Y' failed, error message=" . $e['message']); die; } $arUserProcess = []; while ($row = oci_fetch_array($stid_user_process, OCI_ASSOC + OCI_RETURN_NULLS)) { $arUserProcess[] = $row; } foreach ($arUserProcess as $item) { $FName = $item["FILE_NAME"]; if (!is_running($item["PROCESS_ID"])) { if (file_exists($zip_file_output_dir . $FName)) { //Everything is ready - send the e-mail /* recipients */ $to = $item["EMAIL_ADDRESS"]; /* topic/subject */ $subject = "OMOP Vocabularies. Your download link"; /* message */ if (substr($FName, 0, 17) == 'vocab_download_v4') { /* link to V4.5 control files folder */ $ctl_files_folder = 'https://github.com/OHDSI/CommonDataModel/tree/master/Version4'; } else { /* link to V5 control files folder */ $ctl_files_folder = 'https://github.com/OHDSI/CommonDataModel'; } $message = '
function unzipFile($downloadDir, $filename, $name) { global $logfile, $cfg; $log = $downloadDir . $logfile; $unzip = $cfg['bin_unzip']; if (file_exists($log)) { @unlink($log); } if ($downloadDir . '/' . $filename === $downloadDir . '/' . $name) { $destdir = $downloadDir . '/' . str_replace('.zip', '/', $name); } else { $destdir = $downloadDir . '/' . $name; } $Command = tfb_shellencode($unzip) . ' -o ' . tfb_shellencode($downloadDir . '/' . $filename) . ' -d ' . tfb_shellencode($destdir); debug($Command . "\n"); $unzippid = trim(shell_exec("nohup " . $Command . " > " . tfb_shellencode($log) . " 2>&1 & echo \$!")); debug($unzippid . "\n"); echo 'Uncompressing file...<BR>PID is: ' . $unzippid . '<BR>'; usleep(250000); // wait for 0.25 seconds while (is_running($unzippid)) { usleep(250000); // wait for 0.25 seconds /* occupy time to cause popup window load bar to load in conjunction with unzip progress */ } }
$row_start = $rows_cnt - 1; $row_add = -1; } for ($i = 0; $i < $rows_cnt; $i++) { mysql_data_seek($result, $row_start + $row_add * $i); $row = mysql_fetch_object($result); if ($top == -1) { $top = $row->solution_id; } $bottom = $row->solution_id; if ($cnt) { echo "<tr align=center class='oddrow'>"; } else { echo "<tr align=center class='evenrow'>"; } $flag = !is_running(intval($row->contest_id)) || isset($_SESSION['administrator']) || strcmp($row->user_id, $_SESSION['user_id']) == 0; $cnt = 1 - $cnt; echo "<td>" . $row->solution_id; echo "<td><a href='userinfo.php?user="******"'>" . $row->user_id . "</a>"; if (isset($cid)) { echo "<td><a href='problem.php?cid={$cid}&pid={$row->num}'>" . $PID[$row->num] . "</a>"; } else { echo "<td><a href='problem.php?id=" . $row->problem_id . "'>" . $row->problem_id . "</a>"; } if (intval($row->result) == 11 && ($row->user_id == $_SESSION['user_id'] || isset($_SESSION['source_browser']))) { echo "<td><a href='ceinfo.php?sid={$row->solution_id}'><font color=" . $judge_color[$row->result] . ">" . $judge_result[$row->result] . "</font></a>"; } else { echo "<td><font color=" . $judge_color[$row->result] . ">" . $judge_result[$row->result] . "</font>"; } if ($flag) { if ($row->result == 4) {
sleep(5); shell_exec("/bin/kill -9 {$pids} 2>/dev/null"); } foreach ($mysql_sockets as $socket) { if ($verbose) { print "Running serverCleanup for socket {$socket}\n"; } OnlineSchemaChange::serverCleanup($socket, $db_admin_user, $db_admin_pass); if ($verbose) { print "Done\n"; } } exit(0); } // make sure this script is not already running $ps_check = is_running($this_script); if ($ps_check > 4) { print "ERROR: there are already {$ps_check} instances" . " of {$this_script} running.\n"; exit(1); } if ($mode == 'statement') { $ddl_list = read_sql($ddl_file); if (!$ddl_list) { print "ERROR: Schema file {$ddl_file} cannot be read!\n"; exit(1); } else { } } else { if ($mode == 'seed') { foreach (explode(',', $seed_tables) as $table) { $seed_info = show_table_schema($seed_host, $seed_db, $table);
$view_status[$i][5] = "----"; $view_status[$i][6] = "----"; $view_status[$i][7] = "----"; } $view_status[$i][8] = $row['in_date']; $i++; } else { if ($_SESSION['U']->getF_test() == 1 && ($row['problem_id'] > 1008 && $row['problem_id'] <= 1016 || $row['problem_id'] > 1021 && $row['problem_id'] <= 1026)) { if ($i == 0 && $row['result'] < 4) { $last = $row['solution_id']; } if ($top == -1) { $top = $row['solution_id']; } $bottom = $row['solution_id']; $flag = !is_running(intval($row['contest_id'])) || isset($_SESSION['source_browser']) || $_SESSION['U']->getAut() == "admin" || !strcmp($row['user_id'], $_SESSION['U']->getU_id()); $cnt = 1 - $cnt; $view_status[$i][0] = $row['solution_id']; if ($row['contest_id'] > 0) { $view_status[$i][1] = "<a href='contestrank.php?cid=" . $row['contest_id'] . "&user_id=" . $row['user_id'] . "#" . $row['user_id'] . "'>" . $row['user_id'] . "</a>"; } else { $view_status[$i][1] = "<a id=\"blue\">" . $row['user_id'] . "</a>"; } $turnedid = turnid($row['problem_id']); $view_status[$i][2] = "<div class=center><a href='problem.php?id=" . $row['problem_id'] . "'>" . $turnedid . "</a></div>"; if (intval($row['result']) == 11 && ($row['user_id'] == $_SESSION['U']->getU_id() || isset($_SESSION['source_browser']))) { $view_status[$i][3] = "<a href='ceinfo.php?sid=" . $row['solution_id'] . "' class='" . $judge_color[$row['result']] . "'>" . $MSG_Compile_Click . "</a>"; } else { if ((intval($row['result']) == 6 || $row['result'] == 10 || $row['result'] == 13) && ($row['user_id'] == $_SESSION['U']->getU_id() || isset($_SESSION['source_browser']))) { $view_status[$i][3] = "<a href='reinfo.php?sid=" . $row['solution_id'] . "' class='" . $judge_color[$row['result']] . "'>" . $judge_result[$row['result']] . "</a>"; } else {
function wait_for_pid($pid) { while (is_running($pid)) { usleep(100000); } }
$data['data'] = ossim_get_error_clean(); echo json_encode($data); exit; } $data['status'] = 'error'; $data['data'] = _('Action not allowed'); switch ($action) { case 'nfsen_status': $sensor_id = POST('sensor_id'); ossim_valid($sensor_id, OSS_HEX, 'illegal:' . _('Sensor ID')); if (ossim_error()) { $data['status'] = 'error'; $data['data'] = _('Error! Sensor ID not allowed'); } else { $sensor_name = strtoupper($sensor_id); $data = is_running($sensor_name); } break; case 'delete': $sensor_id = POST('sensor_id'); ossim_valid($sensor_id, OSS_HEX, 'illegal:' . _('Sensor ID')); if (ossim_error()) { $data['status'] = 'error'; $data['data'] = _('Error! Sensor ID not allowed'); } else { $sensor_name = strtoupper($sensor_id); $nfsen_sensors = get_nfsen_sensors(); if ($nfsen_sensors[$sensor_name] != '') { unset($nfsen_sensors[$sensor_name]); set_nfsen_sensors($nfsen_sensors); nfsen_reset($nfsen_dir);
function reconfigure() { $unix = new unix(); $echo = $unix->find_program("echo"); checkFilesAndSecurity(); if (!is_running()) { echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service not running...\n"; return; } echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service reconfigure service...\n"; shell_exec("{$echo} -n \"reconfigure\" > /var/run/c-icap/c-icap.ctl"); }