exec

How do you run a .bat file from PHP?

Can anyone tell me how to execute a .bat file from a PHP script? I have tried - exec("C:[path to file]"); system("C:[path to file]"); nothing is working. Ive checked the PHP manuals and googled around but cant find a good answer. Anyone know where im going wrong? I'm running windows 2003 server and have successfully manually ran the ...

SQL iterating over a list to call EXEC on each item

Attempt to generalize my questions... I want to execute a stored procedure for each result returned by a SELECT statement. Mentally I want to try something like EXEC myStoredProc (SELECT id FROM sometable WHERE cond = @param) More details related to my specific case... I have a SaaS application. I would like to delete a tenant from th...

Using exec() with recursive functions

I want to execute some Python code, typed at runtime, so I get the string and call exec(pp, globals(), locals()) where pp is the string. It works fine, except for recursive calls, e. g., for example, this code is OK: def horse(): robot.step() robot.step() robot.turn(-1) robot.step() while True: horse() But t...

ExecWB Print Preview Sometimes shows blank pages.

Hello.. This is a weird one. I am using the ExecWB method to create a PrintPreview window. Most of the time the print preview appears correctly. But sometimes it shows a blank page and that is all. Has anyone seen this before? The problem appears to be isolated to IE6. The problem is very hit and miss so it is difficult to determine wha...

Python: Spawn parallel child processes on a multi-processor system - use multiprocessor package, subprocess package, XYZ package?

Hi there, I am a Python newbie so please be gentle :) I have a Python script that I want to use as a controller to another Python script. I have a server with 64 processors, so want to spawn up to 64 child processes of this second Python script. The child script is called: %> python create_graphs.py --name=NAME where NAME is somethi...

PHP hangs waiting for exec to return results from wget+mysql command

Related: see here I've got this command: exec("(wget -O http://domain/file.zip && mysql -u user -ppassword database -e \"UPDATE \\`table\\` SET \\`status\\` = 'live' WHERE \\`id\\` = '1234'\") & echo \$!"); The above command works fine, however PHP waits for the video to finish downloading before going on to the next download. The f...

How to exit a child process and return its status from execvp()?

In my simple custom shell I'm reading commands from the standard input and execute them with execvp(). Before this, I create a fork of the current process and I call the execvp() in that child process, right after that, I call exit(0). Something like this: pid = fork(); if(pid == -1) { perror("fork"); exit(1); } if(pid == 0) ...

exec statement with/without prior compile

These weekend I've been tearing down to pieces Michele Simionato's decorator module, that builds signature-preserving decorators. At the heart of it all there is a dynamically generated function, which works something similar to this... src = """def function(a,b,c) :\n return _caller_(a,b,c)\n""" evaldict = {'_caller_' : _caller_} co...

Class attributes with a "calculated" name

When defining class attributes through "calculated" names, as in: class C(object): for name in (....): exec("%s = ..." % (name,...)) is there a different way of handling the numerous attribute definitions than by using an exec? getattr(C, name) does not work because C is not defined, during class construction... ...

Inconsistent Video Conversion

I have a script calling a command to run an ffmpeg conversion on an uploaded video. It works only at random times however. Sometimes the form will finish submitting and the ffmpeg process will be running; at other times, the ffmpeg command fails to run at all. Here is the command that I'm running in an exec() function: ffmpeg -i "uploa...

Having trouble with fork(), pipe(), dup2() and exec() in C

Here's my code: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <wait.h> #include <readline/readline.h> #define NUMPIPES 2 int main(int argc, char *argv[]) { char *bBuffer, *sPtr, *aPtr = NULL, *pipeComms[NUMPIPES], *cmdArgs[10]; int fdPipe[2], pCount, aCount, i, status, lPids[NUMPIPES]; pid_t pid; ...

Create a new independent process from another C process

Two C executables A and B exist. A and B communicate to each other through a socket. B can be started independently or through A. If B is started first and A is started next, then A and B start properly without issues. Even if A is restarted, then there are no issues. If B is started through A, then A and B starts properly. But here ...

How do I launch a completely independent process from a Java program?

I am working on a program written in Java which, for some actions, launches external programs using user-configured command lines. Currently it uses Runtime.exec() and does not retain the Process reference (the launched programs are either a text editor or archive utility, so no need for the system in/out/err streams). There is a minor...

Problem using PHP exec command to execute a batch file

I'm attempting to get PHP to call a batch file which will take an RTF file and convert it to a PDF using an OpenOffice macro. I've tested the batch file on the command line and it works fine, but I'm not having any luck calling and using the same batch file from PHP. My machine OS is XP professional SP 3. I'm running IIS 6 and PHP ver...

Does this multiple pipes code in C makes sense?

I've created a question about this a few days. My solution is something in the lines of what was suggested in the accepted answer. However, a friend of mine came up with the following solution: Please note that the code has been updated a few times (check the edit revisions) to reflect the suggestions in the answers below. If you intend...

How can I call another script repeatedly?

Hi all, I'm trying to write a Perl script that calls another script, that reads an entire directory. I don't get any errors, but i don't get the expected result either. I don't get anything on the screen. I don't need to output anything on screen. The script I'm calling in the exec() statement should read each image file into the DIR di...

Best way to sanitize exec command with user inserted variables.

I'm coding a web interface to a horrible piece of propitiatory software our company uses. the software has no real UI and requires us giving putty access to our system for our clients to even pull data. My web interface has to run an exec(); function and it has to pass a few variables the user inputs. $command = "report-call '$type' '$s...

Ruby: print the code of an arbitrary method (and exec in context)

I would like to do something like the following: class String def fancy_thing appendix # Just a trivial example to ensure self and params work. # Pretend this is something complex. self.reverse + appendix end end # print_method on instance or class should spit out a string # containing the actual code for that method ft_c...

Is it possible to execute a string in MySQL?

I have to convert an MSSQL stored proc that passes a varchar that is a query. The proc has the following command: INSERT INTO Results EXEC (@Expresion); This isn't working. I'm pretty sure that EXEC and EXECUTE arent MySQL commands but CALL doesn't work either. Does anyone know if its even possible to have something like JavaScript'...

How to use an expect script from php webpage ?

Hello, When i try to execute a program from php5 on my debian, the webpage freeze and the program do nothing. This script works when i call it from the command line. Safe mode is disabled. Echo stdout doesnt work (because of the freeze). I read some answers in google which tells of www permissions but if someone here have a quick and si...