exec

Get the child PID after system()

Hi, As far as I understand, the system() call uses internally fork() and exec() but encapsulates them for a easier handling. Is it possible to get the PID from the child process created with the system() call? Aim: I want to be able to SIGINT any child process after a certain timeout. I could rebuild the system() function by using fo...

Setting permission for PHP (or I_USER [I'm not sure here...]) to connect to iisweb.vbs

I have been trying to figure out a way to manage our domains at work and easily created a SimpleDNS class, but now I'm on the IIS Server Administration side of it and I'm just lost on what is going on. Here is the PHP code I am running to test it. <?php $cmd = 'iisweb /create c:\websites\examplesite.com\www "Example Domain!" /d www.exa...

Is there a cross-platform exec in Boost?

I want to execute a sub-process in C++. I need it to work on Windows and Linux. Is there such a function in Boost? What is the standard way of doing it? ...

How to handle execvp(...) errors after fork()?

I do the regular thing: fork() execvp(cmd, ) in child If execvp fails because no cmd is found, how can I notice this error in parent process? ...

How to wait for process child?

I do the usual fork + exec combination: int sockets [2]; socketpair (AF_LOCAL, SOCK_STREAM, 0, sockets); int pid = fork (); if (pid == 0) { // child dup2 (sockets[0], STDIN_FILENO); dup2 (sockets[0], STDOUT_FILENO); execvp (argv[0], argv); _exit (123); } // parent close (sockets[0]); // TODO wait and see if child crashes I...

how to select a particular table from a storedprocedure which returns multiple table?

Hi all, I have a storedproc which has multiple select statement. When it is executed in sql server , it returns multiple tables. I need a query which will select a particular table from the storedproc e.g. sp_help. Please help. ...

How can I make sure all the output from ant's exec task gets printed on stdout?

The ant exec task has an output property which can be used to tell ant where the output goes. I've used it to redirect the output to a file. The thing is, if I don't do something with the output, the stuff that ant prints isn't that much of a help ( it's not the complete thing ). Is there someway of setting the output property to System...

How do I exec() a process in the background in C?

I've done a fork and exec() on a process, but I'd like to run it in the background. How can I do this? I can just avoid calling waitpid on it, but then the process sits there for ever, waiting to return it's status to the parent. Is there some other way to do this? ...

how to get pointer to user memory address space in Os/161 in execv

I am writing execv(char *program, char **args) call in Os/161. So, I get a copy of data user provided in program and in args in kernel space. Then I create brand new address space to which program with args is loaded. The question is how to find appropriate pointer to user space virtual memory in order to copyout data from kernel space...

php exec command - relative paths not working

how to run external program from php with exec command using relative paths? <?php exec('program_name ......'); ?> this works only if program_name.exe is in the same directory as this php script. for example exec('something/program_name ......'); doesnt work if php script is not in the 'something' directory. anybody know...

Exec sproc from Powershell

I would like to execute a stored procedure from Powershell (v2) against a SQL Server 2008 database. Coming from using C# as my primary language, I'm doing it in that fashion. For example, when I need to run a sproc that doesn't return results, here is what I'm doing now: $con = new-object System.Data.SqlClient.SqlConnection($connectionS...

how to set close-on-exec by default

I'm implementing a library to run commands. The library is C, on Linux. It currently does a popen() call to run a command and get output. The problem is that the command inherits all currently open file handlers. If I did a fork/exec I could close the handlers in child explicitly. But that means re-implementing popen(). Can I set clos...

Is it possible using Linux's clone() system call to run multiple applications in the same address space?

If you don't pass the CLONE_VM flag to clone(), then the new process shares memory with the original. Can this be used to make two distinct applications (two main()'s) run in the same process? Ideally this would be as simple as calling clone() with CLONE_VM and then calling exec(), but I realize it's probably more involved. At the very l...

Php : running ssh from Windows to login to a Linux and run a script

Hi ! Here's my goal : I have a Windows XP PC with all the source code in it and a development database. Let's call it "pc.dev.XP". I have a destination computer that runs Linux. Let's call it "pc.demo.Linux". Here's what I've done on "pc.dev.XP" (just so you get the context) : installed all cygwin stuff created a valid rsa key and p...

strtok and execlp in a mini-shell

Hi fellows! I'm writing a mini-shell to get more familiar with Unix process management in C. It's reading stuff from commandline and passes these arguments via execlp to the system. # include <stdio.h> # include <stdlib.h> # include <unistd.h> #define MAXSIZE 100 char prompt[MAXSIZE]; int main(void){ pid_t pid; printf("> ...

exec and fork()

What are the differences between fork() and exec()? ...

Run exec function in PHP

Hi All, I am using exec function to run a bat file and change the default printer. exec file is doing fine, bat file alone is doing fine, but the printer doesn't change when I'm calling the bat file via exec function. I put "echo 1" in the bat file. Browser showed "1" but my printer didn't change. I really need a miracle to solve this !!...

Convert std::vector<char*> to a c-style argument vector arv

I would like to prepare an old-school argument vector (argv) to use within the function int execve(const char *filename, char *const argv[],char *const envp[]); I tried it with the stl::vector class: std::string arguments = std::string("arg1"); std::vector<char*> argv; char argument[128]; strcpy(argument, arguments.c_str()...

Difference between "system" and "exec" in Linux?

What is the difference between system and exec family commands? Especially i want to know which one of them creates child process to work? ...

Problem with running the Nutch command from PHP exec()

My Nutch directory lies in /home/myserv/nutch/nutch-1.0/ My php applictaion is in the diretcory /home/myserv/www/ Theres a a php file in my /home/myserv/www/ diretcory that runs a exec command to run a nutch command.PHP code is like : $output = exec("bin/nutch all"); When I run the command from the command line I need to be in th...