exec

PHP exec() not working - exiting early? no error?

i am using PHP to run exec() on a script which looks like this: exec("pdftk xx.pdf fill_form xx.fdf output xx.pdf flatten"); the strangest thing is that when i log in to ssh and put the command in manually - it works fine! it outputs a 224k pdf. but when i use the exec() command, only the first 36k of the script comes out. (i checked ...

Location of cd executable

I read that the executables for the commands issued using exec() calls are supposed to be stored in directories that are part of the PATH variable. Accordingly, I found the executables for ls, chmod, grep, cat in /bin. However, I could not find the executable for cd. Where is it located? ...

How to read command line ouput from Java (via Runtime.getRuntime().exec(...))

I'm trying to present some information in a Swing application about the existance of symlinks. The GUI has a JTextArea resultTextArea and a JTextField statusField. This is the code inside the Dialog class: public void checkForSymLinks(File... dirs) { for (File dir : dirs) { try { Process p = Runtime.getRuntime()....

Is it possible to suppress NAnt's exec task's "[exec]" console output prefix

I'm trying to integrate Robot Framework (an acceptance testing framework) with TeamCity. In order to do this it needs to send messages to the console output which TeamCity will then read and return realtime test progress/results. I'm doing this by calling the command line to run the tests with a simple exec task. Everything seemed to be ...

Most efficient way to extract PyTables table with stored colnames as variable names

The following code provides my needed functionality; but, takes a bit more than 10 seconds for a table that includes 200 variables with 64000 rows. Is there a more efficient way to create a variable namespace that matches the column names? strExec = "a = table[:]" for colobj in table.description._f_walk(type="Col"): colName = co...

how can I get the return value of a program executed by exec?

Hi, I have this c code: if(fork()==0){ execl("/usr/bin/fsck", "fsck", "/dev/c0d0p1s0", NULL); } it calls execl to run fsck for checking the filesystem /dev/c0d0p1s0. My question is: how can I get the return value of fsck? I need the return value of fsck to check whether the file system is consistence or not. Thank you. ...

How to run Java program and get output in PHP?

I'd like to run something like (in myProgram.sh): java -cp whatever.jar com.my.program $1 within PHP and read the output. So far I have something like: $processOrderCommand = 'bash -c "exec nohup setsid /myProgram.sh ' . $arg1 . ' > /dev/null 2>&1 &"'; exec($processOrderCommand); But what I'd really like is to be able to get the o...

Using -exec option with Find command in Bash.

I am trying to use the -exec option with the find command to find specific files in my massive panoramas directory and move them to a specified location. The command I am using below passes an error argument not found for -exec. Can somebody point out my error in parsing the command? Or would I have to create a pipe of some sorts instead...

UNIX: Calling exec on the parent process after a fork

Hello, I am writing in my grammar, in LEX, some code to fork() my process and run a child. The child actually gets some input from the parent, and then returns a result. I need to call exec on the same binary that loaded the parent, but there I am having an issue. I know that exec does not mean complete sense, but I do this because I h...

There is a way to use CLASS_EXISTS and __autoload without CRASH the script?

Example: ClassName.php <?php echo "This will crash all"; ?> In another file... foreach ($FILENAMES_WITHOUT_DOT_PHP as $name => $value) { if (class_exists( $value )) { echo "ClassName exists..."; } else { echo "ClassName doesn't exists...."; } } The output of this code is: This will crash all Instead o...

not enough variables to fit a sentinel

According to exec reference, calls to exec (or stack checking vararg functions in general) requires a (char*)NULL aka 0 at the end of the parameter list. GCC, however, is complaining about the following code char cmdFullPath[4096]; //yes this 4096 thing is bad coding practice ... execl(cmdFullPath, (char*)NULL); //warning: not enough ...

php exec command (or similar) to not wait for result

I have a command I want to run, but I do not want PHP to sit and wait for the result. <?php echo "Starting Script"; exec('run_baby_run'); echo "Thanks, Script is running in background"; ?> Is it possible to have PHP not wait for the result.. i.e. just kick it off and move along to the next command. I cant find anything, and not sure ...

NAnt <exec> Task Always Returns 0 for Batch Files on Windows XP

I'm encountering an issue with the <exec> task on batch files in my NAnt project files. When running on Windows XP SP 3 (but not Windows Vista or Windows Server 2008) and using NAnt 0.85 or 0.91alpha2, the <exec> task will always succeed (returning an error code of 0) regardless of what the executed script returned. As an example, I wr...

Why can't use INSERT EXEC statement within a stored procedure called by another stored procedure?

Hi, First I try to explain the circumstances. I store the the filter expression in one column separated by line breaks. The base idea was this: SELECT 'SELECT ''' + REPLACE(topic_filter,CHAR(10),''' UNION ALL SELECT ''') + '''' FROM dbo.topic_filter T WHERE T.id = @id FOR XML PATH('') After this I simply execute this string to ...

Redirecting standard output to a file containing the pid of the logging process

I've searched for a while but i can't either find an answer or come up with a solution of my own, so I turn to you guys. First question I actually ask here :) I would like to run several instances of the same program, and redirect each of these programs' standard output to a file that contains that same process' pid, something like: my...

php exec() not returning error message in output when executing svn command

Hello everyone. I am trying to get certain output for svn command in XML format. Output is ok when I type valid parameters. However, when I type in wrong password, output does not show error message. This is the PHP code: exec('/usr/bin/svn --username something --password something --non-interactive log -r HEAD --xml --verbose http://a5...

How do I printf() after a call to execlp() in a child process?

I am currently trying to print a message from a child process after calling execlp() within the child. However, nothing appears on the terminal after the call to execlp(). What causes my printf() calls to not display anything, and how can this be resolved? ...

Java Runtime.getRuntime.exec() or ProcessBuilder

Hello, My question is that how to run a .class java file in a directory using exec() or ProcessBuilder class. This only works if the .class file is in the same directory (as the java program). Please help me run a .class file in another directory. Thanks. ...

python : get the print output in an exec statement

i've got a little problem here is my code : code = """ i = [0,1,2] for j in i : print j """ result = exec(code) how could i get the things that print outputed ? bref here how can i get in something : 0 1 2 regards and thanks Bussiere ...

RegExp.exec not returning global results

According to MDC https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/RegExp/exec the following code should log each of the global matches for this regexp. var str = "(^|\\+)(1\\+1)($|\\+)"; var regex = new RegExp(str, "g"); var result; var testString = "1+1+1"; while ((result = regex.exec(testString)) != null) { con...