exec

nohup on windows, exec without waiting for finish

拟墨画扇 提交于 2019-12-28 06:25:08
问题 Is there something like this for Windows? exec("nohup /usr/bin/php -f sleep.php > /dev/null 2>&1 &"); 回答1: It's not that hard (albeit with some minor differences)... You just need to use the WScript.Shell COM object: $shell = new COM("WScript.Shell"); $shell->run($command, 0, false); That's it... 回答2: By default, the Windows command start does not wait for the child process. You may want the /b switch to avoid creating a Command Prompt window. exec("start /b c:\\php\\php.exe -f sleep.php");

Getting PHP to run a Python script

帅比萌擦擦* 提交于 2019-12-28 06:20:45
问题 I am trying to run a Python program using PHP. Here's the code $command = '/usr/local/bin/python script.py file'; $temp = exec($command, $output); This works through the command line but not while running it through the browser. I am using Apache so probably it needs the right privileges? I am pretty new to Linux and have no idea how to get this working. Any help would be appreciated! Edit 1: Tried to use proc_open but nothing happens. I gave the full path to the script. Made the script

PHP exec() performance

一曲冷凌霜 提交于 2019-12-28 06:18:18
问题 The following PHP code does return me a runtime of about 3.5 seconds (measured multiple times and averaged): $starttime = microtime(true); exec('/usr/local/bin/convert 1.pdf -density 200 -quality 85% 1.jpg'); $endtime = microtime(true); $time_taken = $endtime-$starttime; When i run the same command over a ssh terminal, the runtime is reduced to about 0.6 seconds (measured with the command line tool time ). The version of the imagemagick library is Version: ImageMagick 6.7.0-10 2012-12-18 Q16

Java Runtime exec() fails to escape characters properly

荒凉一梦 提交于 2019-12-28 04:07:10
问题 This might already been answered before but that was regarding unicode and I don't think this is unicode (it's in ASCII so...). When I execute this in my terminal there is no problem what so ever vboxmanage setextradata "Test Machine" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222 However when I use the following in Java Runtime.getRuntime().exec("vboxmanage setextradata \"Test Machine\" \"VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort\" 2222"); It returns an error:

Using Quotes within getRuntime().exec

送分小仙女□ 提交于 2019-12-28 02:06:11
问题 I'd like to invoke bash using a string as input. Something like: sh -l -c "./foo" I'd like to do this from Java. Unfortunately, when I try to invoke the command using getRuntime().exec , I get the following error: foo": -c: line 0: unexpected EOF while looking for matching `"' foo": -c: line 1: syntax error: unexpected end of file It seems to be related to my string not being terminated with an EOF. Is there a way to insert a platform specific EOF into a Java string? Or should I be looking

Can't execute PHP script using PHP exec

余生颓废 提交于 2019-12-28 01:55:16
问题 I am trying to invoke a script which takes several seconds (web services with 3rd party) using the PHP exec call. After much struggling, I reduced this to the classic hello world example. The calling script looks like: exec('/usr/bin/php /home/quote2bi/tmp/helloworld.php > /tmp/execoutput.txt 2>&1 &'); When I run this, the output execoutput.txt contains a copy of the invoking script page, not hello world as I expected. Why can't I get this PHP script to execute using exec? Note that when I

find: missing argument to -exec

南笙酒味 提交于 2019-12-28 01:39:49
问题 I was helped out today with a command, but it doesn't seem to be working. This is the command: find /home/me/download/ -type f -name "*.rm" -exec ffmpeg -i {} -sameq {}.mp3 && rm {}\; The shell returns find: missing argument to `-exec' What I am basically trying to do is go through a directory recursively (if it has other directories) and run the ffmpeg command on the .rm file types and convert them to .mp3 file types. Once this is done, remove the .rm file that has just been converted. I

Redirect Runtime.getRuntime().exec() output with System.setOut();

我们两清 提交于 2019-12-28 01:04:18
问题 I have a program Test.java: import java.io.*; public class Test { public static void main(String[] args) throws Exception { System.setOut(new PrintStream(new FileOutputStream("test.txt"))); System.out.println("HelloWorld1"); Runtime.getRuntime().exec("echo HelloWorld2"); } } This is supposed to print HelloWorld1 and HelloWorld2 to the file text.txt. However, when I view the file, I only see HelloWorld1. Where did HelloWorld2 go? Did it vanish into thin air? Lets say I want to redirect

How to call execl() in C with the proper arguments?

倾然丶 夕夏残阳落幕 提交于 2019-12-27 14:57:07
问题 i have vlc (program to reproduce videos) if i type in a shell: /home/vlc "/home/my movies/the movie i want to see.mkv" it opens up an reproduces the movie. however, when I run the following program: #include <unistd.h> int main(void) { execl("/home/vlc", "/home/my movies/the movie i want to see.mkv",NULL); return 0; } vlc opens up but doesn't reproduce anything. How can I solve this? Things I tried: I guessed execl("/home/vlc", "/home/my movies/the movie i want to see.mkv",NULL); was

How to call execl() in C with the proper arguments?

做~自己de王妃 提交于 2019-12-27 14:55:49
问题 i have vlc (program to reproduce videos) if i type in a shell: /home/vlc "/home/my movies/the movie i want to see.mkv" it opens up an reproduces the movie. however, when I run the following program: #include <unistd.h> int main(void) { execl("/home/vlc", "/home/my movies/the movie i want to see.mkv",NULL); return 0; } vlc opens up but doesn't reproduce anything. How can I solve this? Things I tried: I guessed execl("/home/vlc", "/home/my movies/the movie i want to see.mkv",NULL); was