public static function stop($pid) { if ($pid) { if (substr(php_uname(), 0, 7) == "Windows") { exec("plansys\\commands\\shell\\pskill.exe -accepteula " . $pid, $output, $input); NodeProcess::removePid($pid); return $input; } else { exec("kill -9 {$pid}"); NodeProcess::removePid($pid); } } }
public function actionIndex() { $connection = @fsockopen($_SERVER['HTTP_HOST'], '8981'); if (is_resource($connection)) { echo "Port 8981 already used"; fclose($connection); } else { /* $cmd = realpath(Yii::getPathOfAlias('webroot') . "/plansys/commands/shell/stream.js"); if (substr(php_uname(), 0, 7) == "Windows") { exec("plansys\commands\shell\psexec.exe -accepteula -i -d node " . $cmd); } else { exec("nodejs " . $cmd . " > /dev/null &"); } * */ NodeProcess::start("/plansys/commands/shell/stream.js"); echo "Nfy Server Started"; } }
public function resetNode() { $pids = Setting::get("nodejs.pid"); if (!is_null($pids) && !empty($pids)) { foreach ($pids as $pid) { NodeProcess::stop($pid); } } }
public static function sendTestMail() { Email::initalSetting(false, true); NodeProcess::start('plansys/commands/shell/tes.mail.js', Email::$path); }