Articles of 执行

如何使用标准input框命令将消息广播到Python的所有bashterminal?

我想把广播信息广播给我的raspbian上的所有bashterminal。 我知道有墙命令来执行这一步,我可以使用os.system python模块来执行命令。 但是,运行命令“wall text.txt”需要sudo权限。 有什么办法从python使用stdin的墙命令?

Linux fork / exec到同一个目录下的应用程序

是否有一个exec变体,将使用当前的应用程序目录来定位目标程序? 我正在使用C ++和Qt来实现“最后的沟渠”错误报告系统。 使用Google Breakpad ,我可以创build一个小型转储并直接执行到一个处理程序。 因为我的应用程序处于不稳定状态,所以我只想使用最小的依赖关系来分叉并启动一个单独的error handling过程。 错误报告应用程序将被部署在与应用程序可执行文件相同的目录中。 我很不熟悉fork和exec选项,并且没有find包含searchpath中当前应用程序目录的exec选项。 这是我到目前为止: static bool dumpCallback(const char* /*dump_path*/, const char* /*minidump_id*/, void* /*context*/, bool succeeded) { pid_t pid = fork(); if (pid == 0) { // This is what I would *like* to work. const char* error_reporter_path = "error_reporter"; // This works, but requires hard-coding the entire […]

如何在屏幕会话中执行命令

我想知道如何在屏幕会话中执行一个命令。 我search了,我发现这个: screen -S nameofscreen -X stuff "command" 当我input这个命令的时候,这个命令是在屏幕上input的,但是不会被执行。 所以我的问题是如何使用这个命令按下input。

php exec / shell_exec / system / popen / proc_open在Linux上运行调用脚本本身无数次

我有一个脚本,使用php -l检查php文件中的语法错误。 它在Windows正常工作,但在Linux中提供不正确的输出: 正在检查语法错误的文件exec_ip.php的内容是(它有语法错误,要检查): <?php $arr['12] = 'asd'; ?> 和脚本是: $slash = file_get_contents('exec_ip.php'); //echo $slash; $tmpfname = tempnam("tmp", "PHPFile"); file_put_contents($tmpfname, $slash); exec("php -l ".$tmpfname,$error); $errtext = ''; foreach($error as $errline) $errtext.='<br>'.$errline; unlink($tmpfname); echo 'ERR:'.$errtext; 结果在WINDOWS(WAMP){CORRRECT}: ERR: Parse error: syntax error, unexpected T_STRING, expecting ']' in C:\WINDOWS\Temp\PHP1F1.tmp on line 2 Errors parsing C:\WINDOWS\Temp\PHP1F1.tmp 结果在LINUX(Centos / cPanel){UNKNOWN […]

在Linux中,如何使用外部jar文件执行Java jar文件?

在Linux中,如何使用外部jar文件执行Java jar文件?

php exec()命令权限被拒绝

我有一个C ++可执行文件'skypeforwarder'。 如果我在Macterminal中使用命令行,skypeforwarder的作品:henry $ /Users/henry/Desktop/skypeForwarder/skypekit-sdk_sdk-4.1.2.20_793394/examples/cpp/tutorial/step3/skypeForwarder sh: /Users/henry/Desktop/skypeForwarder/skypekit-sdk_sdk-4.1.2.20_793394/examples/cpp/tutorial/step3/skypeForwarder: Permission denied 但它总是发出“权限被拒绝”,如果它在php exec()中调用; <?php echo exec('whoami'); $output = null; $execBuild = '/Users/henry/Desktop/skypeForwarder/skypekit-sdk_sdk-4.1.2.20_793394/examples/cpp/tutorial/step3/'; $execBuild .= 'skypeForwarder'; $n = exec($execBuild, $output); 我搜查了很多。 问题应该是Web服务器的PHP /浏览器权限的问题。 我也试图改变文件的所有者: -rwxr-xr-x 1 henry staff 1212716 19 Apr 11:23 skypeForwarder 至 -rwxr-xr-x 1 _www staff 1212716 19 Apr 11:23 skypeForwarder 它仍然不起作用。 我根据http://foundationphp.com/tutorials/php_leopard.php在我的mac中设置了apache

如何检查一个shell命令是否来自PHP

我需要在php中这样的东西: If (!command_exists('makemiracle')) { print 'no miracles'; return FALSE; } else { // safely call the command knowing that it exists in the host system shell_exec('makemiracle'); } 有没有解决办法?

PHP exec()返回值为后台进程(linux)

在Linux上使用PHP,我想确定是否成功执行使用exec()运行的shell命令。 我使用return_var参数来检查一个成功的返回值0.这工作正常,直到我需要做一个进程,必须在后台运行相同的事情。 例如,在以下命令中$ result返回0: exec('badcommand > /dev/null 2>&1 &', $output, $result); 我把redirect放在那里,我不想捕获任何输出。 我只是想知道命令已经成功执行了。 这可能吗? 谢谢,Brian

为什么不执行(“顶”); 在Linux上工作?

我试图执行这个命令 echo exec("top"); 和 echo exec("/usr/bin/top"); 既不工作(返回空白输出) 有人知道为什么吗?

exec退出代码11的含义

我在linux web服务器上使用下面的代码 $error = exec('phantomjs table1.js', $op, $code); echo $code; // prints 11 on screen table1.js var page = require('webpage').create(); var url = 'table1.php'; page.open(url, function (status) { page.render('ss/table1.png'); phantom.exit(); }); table1.php echo '<h1>This should be converted to an image</h1>'; 我通过这个链接,但该代码不在那里列出。 任何想法这个退出代码是什么意思?