exec

How to do interactive with the prompt this way in PHP?

C:\>mysql -uroot -padmin Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.0.37-community-nt-log MySQL Community Edition (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show databases -> ; +--------------------+ | Database | +--------------...

How do I use multiple arguments from an array to construct an execl() call in C?

I have a string array in C named args[] - now how can I use this list of arguments to construct a proper call to execl()? So if the array contains: {"/bin/ls","ls","-a","-l"} ...how can I eventually construct an execl() call that is: execl("/bin/ls","ls","-a","-l",NULL); I must be thinking about this wrong, as I can't find anythi...

Who owns a php exec tar extracted file?

As far as file permissions are concerned, when you use a php script to unzip a tar file, who is the "owner" user of the files created? I'm wondering if its my ftp user because I uploaded the script file? Or does apache own the file? I know their are flags to be set to preserve the original permissions which I don't want (files where cr...

Running exec inside function

How can you use the python exec keyword inside functions? ...

Can a standalone ruby script (windows and mac) reload and restart itself?

I have a master-workers architecture where the number of workers is growing on a weekly basis. I can no longer be expected to ssh or remote console into each machine to kill the worker, do a source control sync, and restart. I would like to be able to have the master place a message out on the network that tells each machine to sync an...

How to stop nant exec task putting ( ) around command line

I have looked through the nant documentation and sourceforge faq and can't find the answer to this question. The exec task in nant puts ( ) around the command line parameters it generates, so for example this task below would generate: mallow ( -1 ) <exec program="${build.tools.wix}\mallow.exe" workingdir="${build.out.xxx}"> ...

Why does concatenating strings in the argument of EXEC sometimes cause a syntax error in T-SQL?

In MS SQL Server Management Studio 2005, running this code EXEC('SELECT * FROM employees WHERE employeeID = ' + CAST(3 AS VARCHAR)) gives this error: Incorrect syntax near 'CAST' However, if I do this, it works: DECLARE @temp VARCHAR(4000) SET @temp = 'SELECT * FROM employees WHERE employeeID = ' + CAST(3 AS VARCHAR) EXEC(@temp) I...

Calling Grep inside Java gives incorrect results while calling grep in shell gives correct results.

I've got a problem where calling grep from inside java gives incorrect results, as compared to the results from calling grep on the same file in the shell. My grep command (called both in Java and in bash. I escaped the slash in Java accordingly): /bin/grep -vP --regexp='^[0-9]+\t.*' /usr/local/apache-tomcat-6.0.18/work/Catalina/localh...

Are there any alternatives to shell_exec and proc_open in PHP?

It seems like I can't use shell_exec or proc_open on my shared server. The message I get when I try to use it is: Warning: shell_exec() has been disabled for security reasons in /home/georgee/public_html/admin/email.php on line 4 Are there any alternatives to these functions? ...

execute python file from another file

Hi I have a python file that has functions and classes. now I am writting another program (in another file). and I want to start the new file with running the old file (with the function and classes). I have tried using exec(path_2_oldFile.pyw) but it didn't work. thanks for any help Ariel ...

C, pass awk syntax as argument to execl

I want to run the following command from a C program to read the system's CPU and memory use: ps aux|awk 'NR > 0 { cpu +=$3; ram+=$4 }; END {print cpu,ram}' I am trying to pass it to the execl command and after that read its output: execl("/bin/ps", "/bin/ps", "aux|awk", "'NR > 0 { cpu +=$3; ram+=$4 }; END {print cpu,ram}'",(char *) ...

C - How can i get return value of command passed to execl?

I know that it is possible to read commands output with a pipe? But what about getting return value ? For example i want to execute: execl("/bin/ping", "/bin/ping" , "-c", "1", "-t", "1", ip_addr, NULL); How can i get returned value of ping command to find out if it returned 0 or 1? ...

SQL Server 2005: Subquery in EXEC ?

EXEC [dbo].[pr_cfgAddFact] @SettingName = 'TransferBatch', @RoleFK = SELECT TOP 1 rolepk FROM cfgRole WHERE cfgRole.Name = 'SuperAdmin' Why would SQL complain about the SELECT clause here? I am trying to run the proc with the sub query getting the data. ...

How do I set a property to the output of a command in msbuild/xbuild

In msbuild/xbuild I'd like to have a "libPath" property which can be ovveridden on the commandline using /p:libpath="/path/to/all/libs". But when this property is undefined I want to call pkg-config --retrieve-Path somePackage to get the current systems path. I thought like here I need the output of a command to be stored in a Property....

Open Office - Execute function

Does anyone know of a macro function in OpenOffice like exec() or system() in other languages? ...

running Echo from Java

I'm trying out the Runtime.exec() method to run a command line process. I wrote this sample code, which runs without problems but doesn't produce a file at c:\tmp.txt. String cmdLine = "echo foo > c:\\tmp.txt"; Runtime rt = Runtime.getRuntime(); Process pr = rt.exec(cmdLine); BufferedReader input = new BufferedReader( ...

PHP exec not working with gcc

I just spent a few hours pulling my hair out over this. I'm trying to get gcc to compile a file from within PHP. $command = "/usr/bin/gcc /var/www/progpad/temp/tNu7rq.c -o /var/www/progpad/temp/tNu7rq.out"; exec($command, $output, $returnVal); echo $returnVal."<br />"; //returns 1 and no output file created. I'm running th...

Faster forking of large processes on Linux ?

What's the fastest, best way on modern Linux of achieving the same effect as a fork-execve combo from a large process ? My problem is that the process forking is ~500MByte big, and a simple benchmarking test achieves only about 50 forks/s from the process (c.f ~1600 forks/s from a minimally sized process) which is too slow for the inten...

PHP exec - check if enabled disabled

I want to know if there's a way to check in a php script if exec() is enabled or disabled on a server.. Thanks! ...

Why are closures broken within exec?

In Python 2.6, >>> exec "print (lambda: a)()" in dict(a=2), {} 2 >>> exec "print (lambda: a)()" in globals(), {'a': 2} Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 1, in <module> File "<string>", line 1, in <lambda> NameError: global name 'a' is not defined >>> exec "print (lambda: a...