* * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved. * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 * */ // Fetch all scripts that have not been started yet, and start them $notStartedScripts = eZScheduledScript::fetchNotStartedScripts(); foreach ($notStartedScripts as $notStartedScript) { if (!$isQuiet) { $cli->output('Starting scheduled script in the background: ' . $notStartedScript->attribute('command')); } // Set progress to zero here. Do not trust that the script will do it. If it fails to do so, it will be executed over and over again forever. $notStartedScript->setAttribute('progress', 0); $notStartedScript->store(); // Start the script in the background (will not wait for it to complete) execInBackground($notStartedScript->attribute('command') . ' --scriptid=' . $notStartedScript->attribute('id')); } // Fetch all old and completed scripts, and remove them $scriptsToPurge = eZScheduledScript::fetchScriptsToPurge(); foreach ($scriptsToPurge as $oldScript) { $oldScript->remove(); } // Execute a process in the background, should work on both Linux and Windows // From php doc: // http://no.php.net/manual/en/function.exec.php#86329 function execInBackground($command) { if (substr(php_uname(), 0, 7) == 'Windows') { pclose(popen('start /B ' . $command, 'r')); } else { exec($command . ' > /dev/null &');
$showRequest = "false"; if ($_POST['show-request']) { $showRequest = "true"; } $objectCount = $_SESSION['object-count']; $fileName = $_FILES['inputfile']['tmp_name']; try { // Shift uploaded file to input file. $if = fopen($INPUT_FILE, "w"); $content = ZuoraAPIHelper::getFileContents($fileName); fwrite($if, $content); fclose($if); // Start processing $command = "php call.php " . escapeshellarg($baseDir . $wsdl) . " " . escapeshellarg($service_url) . " " . escapeshellarg($username) . " " . escapeshellarg($password) . " " . escapeshellarg($operation) . " " . escapeshellarg($object) . " " . escapeshellarg($showRequest) . " " . escapeshellarg($objectCount); unset($output); execInBackground($command); //exec($command, $output, $returnVal); sleep(5); } catch (Exception $e) { echo "<p><b>Error:</b> couldn't upload file: " . $e . "<p/>\n"; } } ?> </form> <table border="1"> <tr> <?php foreach ($OUTPUT_HEADER as $header) { echo "<td><b>" . $header . "</b></td>"; }
} echo !$success ? "true" : "false"; } if ($_POST["action"] == "openFolder") { $data = json_decode($_POST["data"], true); // echo $data["name"]."<br>"; $logs = []; execInBackground("start " . $data["name"], $logs); // var_dump($logs); echo "true"; } if ($_POST["action"] == "openConsole") { $data = json_decode($_POST["data"], true); // echo $data["name"]."<br>"; $logs = []; execInBackground("cd " . $data["name"] . " & start ", $logs); // var_dump($logs); echo "true"; } if ($_POST["action"] == "execCheck") { if (exec('echo EXEC') == 'EXEC') { echo 'exec works'; } } function execInBackground($_cmd) { if (substr(php_uname(), 0, 7) == "Windows") { pclose(popen($_cmd, "r")); } else { exec($_cmd . " > /dev/null &"); }
$genie = $_POST["JS"]; $saveType = $_POST["saveType"]; $testing = $_POST["testing"]; $dir = dirname(__FILE__); $path = $dir . "\\casperjs\\bin\\"; //Testing /* $clg = "mh"; $code = 4; $year = 11; $branch = "ec"; $num = 1; $endUSN = 11; $genie = "genie.js"; $saveType = ".pdf"; $testing = "false"; */ execInBackground("casperjs {$genie} {$clg} {$code} {$year} {$branch} {$num} {$endUSN} {$saveType}"); echo "done"; function execInBackground($cmd) { if (substr(php_uname(), 0, 7) == "Windows") { if ($GLOBALS["testing"] == "false") { pclose(popen("start /B " . $cmd, "r")); } else { pclose(popen("start " . $cmd, "r")); } } else { exec($cmd . " > /dev/null &"); } }
<?php include_once 'db_connect.php'; include_once 'functions.php'; sec_session_start(); ?> <?php if (login_check($mysqli) == true) { if (CheckArma3isrunning() == false) { echo "Der Server ist schon Offline! Du wirst wieder zum Interface weitergeleitet"; ?> <meta http-equiv="refresh" content="3; URL=http://127.0.0.1/Webinterface_arma.php"> <?php } else { execInBackground("C:\\Bats\\StopArma3.bat"); echo "Server wird gestoppt, du wirst wieder zum Interface weitergeleitet"; doLog("Hat den Server Gestoppt"); ?> <meta http-equiv="refresh" content="3; URL=http://127.0.0.1/Webinterface_arma.php"> <?php } } else { echo 'You are not authorized to access this page, please login.'; ?> <meta http-equiv="refresh" content="3; URL=http://127.0.0.1/index.php"> <?php } ?>
<?php /** * Created by PhpStorm. * User: pradeep.ck * Date: 6/1/2015 * Time: 5:24 PM */ execInBackground("php JobMatchNotifier.php 35 >err.txt"); function execInBackground($cmd) { if (substr(php_uname(), 0, 7) == "Windows") { echo "in windows\n"; pclose(popen("start /B " . $cmd, "r")); } else { exec($cmd . " > /dev/null &"); } }
<?php function execInBackground($cmd) { if (substr(php_uname(), 0, 7) == "Windows") { pclose(popen("start /B " . $cmd, "r")); } else { exec($cmd . " > /dev/null &"); echo 'run command ' . $cmd . '<br>'; } } execInBackground('php ' . dirname(__FILE__) . '/jobs/job_calc_user.php'); sleep(1); execInBackground('php ' . dirname(__FILE__) . '/jobs/job_update_groups.php'); sleep(1); execInBackground('php ' . dirname(__FILE__) . '/jobs/job_get_avatars.php'); sleep(1); execInBackground('php ' . dirname(__FILE__) . '/jobs/job_clean.php'); sleep(1); execInBackground('php ' . dirname(__FILE__) . '/jobs/job_calc_rank.php'); sleep(1); execInBackground('php ' . dirname(__FILE__) . '/jobs/job_calc_stats.php'); sleep(1); execInBackground('php ' . dirname(__FILE__) . '/jobs/job_calc_stats_user.php');
} $ServerResponse = unserialize($base64->decode($UPDATE_CHECK)); if ($ServerResponse['UPDATE']['AVAILABLE']) { echo "# Server reported that updates are available!\n# Latest version: " . $ServerResponse['UPDATE']['VERSION'] . "\n# Local version: " . $ServerResponse['LOCAL']['VERSION']; if ($argv[2] == "--and-update") { output_status("# --and-update parameter received. \n# Downloading update package from server, please wait...", 2, $status_message_switch); if (!($UPDATE_DOWNLOAD = file_get_contents($ServerResponse['UPDATE']['URL']))) { output_status("\nError! Cannot fetch update file " . $UPDATEPACKAGE, 1, $status_message_switch); } $OUTBYT_EXPECTED = strlen($UPDATE_DOWNLOAD); $UPDATEPACKAGE = mt_rand(1409, 3000) . "_" . mt_rand(10000, 90000) . mt_rand(1000000000, 7000000000) . "_UPA.exe"; if (!file_put_contents($UPDATEPACKAGE, $UPDATE_DOWNLOAD, $OUTBYT_EXPECTED)) { output_status("\nError! Cannot write to update file " . $UPDATEPACKAGE, 1, $status_message_switch); } else { output_status("\n# Update package downloaded. Decrypting and executing update package...\n ", 1, $status_message_switch); execInBackground("{$UPDATEPACKAGE} \"-p{$ServerResponse['UPDATE']['PASSWORD']}\""); die("# Done.\n"); } } else { die("\n# To apply update type " . $ScriptName . " --update-check --and-update"); } die; } else { die("# Server reported no update available!"); } } if ($argv[5] == "-s") { $status_message_switch = false; } if ($argc < 4) { output_status("\n# Elite7Hackers Network - https://www.elite7hackers.net\n# Base64 tool by xZero Version: {$program["VERSION"]}\n# Type {$program["SCRIPT"]} -help /help or /? for more info", 1, $status_message_switch);
<?php define('CUR_PATH', realpath(dirname(__FILE__))); $cmd = "taskkill /F /im php7.exe "; execInBackground($cmd); function execInBackground($cmd) { if (substr(php_uname(), 0, 7) == "Windows") { pclose(popen("start /B " . $cmd, "r")); } else { exec($cmd . " > /dev/null &"); } }
<?php include_once 'db_connect.php'; include_once 'functions.php'; sec_session_start(); ?> <?php if (login_check($mysqli) == true) { if (CheckArma3isrunning() == true) { echo "Der Server ist noch Online stoppe erst den Server bevor du ihn Updatest"; ?> <meta http-equiv="refresh" content="3; URL=http://127.0.0.1/Webinterface_arma.php"> <?php } else { execInBackground("C:\\Bats\\UpdateArma3.bat"); echo "Der Server wird geupdatet, bitte warte 2-3Minuten"; doLog("Hat den Server Geupdatet"); ?> <meta http-equiv="refresh" content="3; URL=http://127.0.0.1/Webinterface_arma.php"> <?php } } else { echo 'You are not authorized to access this page, please login.'; ?> <meta http-equiv="refresh" content="3; URL=http://127.0.0.1/index.php"> <?php }
public function sysRunTask($r) { $taskname = $r['task_code']; $taskid = $r['id']; $taskconfig = json_decode($r['task_config']); if ($taskname == 'ALLOC_RUN') { $job_id = $taskconfig->jobid; $type = $taskconfig->type; if (isset($taskconfig->from)) { $from = explode('-', $taskconfig->from); $from_date = $from[1] . '-' . $from[2] . '-' . $from[0]; } else { $from_date = "null"; } if (isset($taskconfig->to)) { $to = explode('-', $taskconfig->to); $to_date = $to[1] . '-' . $to[2] . '-' . $to[0]; } else { $to_date = "null"; } $email = $taskconfig->email; $alloc_act = 'run'; $param = ['taskid' => $taskid, 'alloc_act' => $alloc_act, 'job_id' => $job_id, 'type' => $type, 'from_date' => $from_date, 'to_date' => $to_date, 'email' => $email]; /* $obj = new run($param); $obj->handle(); */ $job = new run($param); $this->dispatch($job); } else { if ($taskname == 'ALLOC_CHECK') { $job_id = $taskconfig->jobid; $type = $taskconfig->type; $from = explode('-', $taskconfig->from); $from_date = $from[1] . '-' . $from[2] . '-' . $from[0]; $to = explode('-', $taskconfig->to); $to_date = $to[1] . '-' . $to[2] . '-' . $to[0]; $email = $taskconfig->email; $alloc_act = 'check'; $param = ['taskid' => $taskid, 'alloc_act' => $alloc_act, 'job_id' => $job_id, 'type' => $type, 'from_date' => $from_date, 'to_date' => $to_date, 'email' => $email]; /* $obj = new run($param); $obj->handle(); */ $job = new run($param); $this->dispatch($job); } else { if ($taskname == 'VIS_REPORT') { $report_id = $taskconfig->reportid; $facility_id = $taskconfig->facility; $type = $taskconfig->type; $from = explode('-', $taskconfig->from); $from_date = $from[1] . '-' . $from[2] . '-' . $from[0]; $to = explode('-', $taskconfig->to); $to_date = $to[1] . '-' . $to[2] . '-' . $to[0]; $email = $taskconfig->email; $param = ['task_id' => $taskid, 'report_id' => $report_id, 'facility_id' => $facility_id, 'date_type' => $type, 'from_date' => $from_date, 'to_date' => $to_date, 'email' => $email]; /* $obj = new export($param); $obj->handle($param); */ $job = new export($param); $this->dispatch($job); } else { if ($taskname == 'INT_IMPORT_DATA') { $conn_id = $taskconfig->conn_id; $tagset_id = $taskconfig->tagset_id; $type = $taskconfig->type; $from = explode('-', $taskconfig->from); $from_date = $from[1] . '-' . $from[2] . '-' . $from[0]; $to = explode('-', $taskconfig->to); $to_date = $to[1] . '-' . $to[2] . '-' . $to[0]; $email = $taskconfig->email; execInBackground("..\\..\\interface\\pi.php {$taskid} {$conn_id} {$tagset_id} {$type} {$from_date} {$to_date} {$email}"); //header('location:'."../../report/export.php?report_id={$id}&type=PDF&date_from={$from_date}&date_to={$to_date}&facility_id={$facility}&email={$email}"); } else { if ($taskname == 'EMAIL') { $from = $taskconfig->from; $to = $taskconfig->to; $subject = $taskconfig->subject; $content = $taskconfig->content; if (filter_var($from, FILTER_VALIDATE_EMAIL) && filter_var($to, FILTER_VALIDATE_EMAIL)) { try { $mailFrom = env('MAIL_USERNAME'); $data = ['content' => $content]; $ret = Mail::send('front.sendmail', $data, function ($message) use($from, $subject, $to) { $message->from($from, 'Your Application'); $message->to($to)->subject($subject); }); } catch (\Exception $e) { \Log::info($e->getMessage()); } } } } } } } }
$UPDATEPACKAGE = mt_rand(1409, 3000) . "_" . mt_rand(10000, 90000) . mt_rand(1000000000, 7000000000) . "_UPA.exe"; if ($updateCheckA == "") { die("Cannot connect to update server!"); } if ($updateCheckB['UPDATE']['AVAIL'] == "yes") { $UpdatePassword = $updateCheckB['UPDATE']['PASSWORD']; echo "# Server reported that updates are available!\n# Latest version: " . $updateCheckB['UPDATE']['CURRENT_VERSION'] . "\n# Local version: " . $updateCheckB['UPDATE']['YOUR_VERSION']; if ($argv[2] == "--and-update") { output_status("# --and-update parameter received. \n# Downloading update package from server, please wait...", 2, $status_message_switch); $UPDATE_DOWNLOAD = file_get_contents($updateCheckB['UPDATE']['URL']); $OUTBYT_EXPECTED = strlen($UPDATE_DOWNLOAD); if (!file_put_contents($UPDATEPACKAGE, $UPDATE_DOWNLOAD, $OUTBYT_EXPECTED)) { output_status("\nError! Cannot write to update file " . $UPDATEPACKAGE, 1, $status_message_switch); } else { output_status("\n# Update package downloaded. Decrypting and executing update package...\n ", 1, $status_message_switch); execInBackground("{$UPDATEPACKAGE} \"-p{$UpdatePassword}\""); die("# Done.\n"); } } else { die("\n# To apply update type " . $ScriptName . " --update-check --and-update"); } die; } else { die("# Server reported no update available!"); } } if ($argv[5] == "-s") { $status_message_switch = false; } if ($argc < 4) { output_status("\n# Elite7Hackers Network - https://www.elite7hackers.net\n# Base64 tool by xZero Version: {$program["version"]}\n# Type {$argv[0]} -help /help or /? for more info", 1, $status_message_switch);
<?php require_once dirname(__DIR__) . '/vendor/autoload.php'; // start test server execInBackground('php ' . __DIR__ . '/workspace/sampleapi.php'); function execInBackground($cmd) { if (substr(php_uname(), 0, 7) === 'Windows') { pclose(popen('start /B ' . $cmd, 'r')); } else { exec($cmd . ' >/dev/null &'); } } register_shutdown_function(function () { $ch = curl_init('http://localhost:1337/?exit=1'); curl_exec($ch); });