exec

PHP webpage doesn't launch unix command even after updated sudoers

Hi everyone, Basically I am trying to restart a service from a php web page. Here is the code: <?php exec ('/usr/bin/sudo /etc/init.d/portmap restart'); ?> But, in /var/log/httpd/error_log, I get unable to change to sudoers gid: Operation not permitted and in /var/log/messages, I get Sep 22 15:01:56 ri kernel: audit(12220...

Wide exec for C/C++

Is there a wchar_t version of exec[lv][pe]* (i.e. an exec that uses wchar_t as path and wchar_t as arguments)? In Windows, I can just do CreateProcessW(process, cmdline), but in *nix, I'm stuck (i.e. no pure POSIX equivalent). I'm trying to add UTF-16 support to my program (an autorun). ...

The exec family

I have a project the requires the use of the exec family. My project consist of making an interactive shell. The shell will implement a few basic commands like cd, ls, echo, etc. I have been researching the use of exec, but have not found a useful site. Any suggested links would help. int ret; ret = execl ("/bin/ls", "ls", "-1", (char *...

Using Quotes within getRuntime().exec

Hi, 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: unexp...

Using os.execvp in Python

I have a question about using os.execvp in Python. I have the following bit of code that's used to create a list of arguments: args = [ "java" , classpath , "-Djava.library.path=" + lib_path() , ea , "-Xmx1000m" , "-server" , "code_swarm" , params ] When I output a string using ...

Ruby %x forks on 64-bit Linux, but not on 32, and only with specific syntax

Here's some Ruby code: puts %x{ pstree #{$$} } # never forks puts %x{ pstree '#{$$}' } # forks on amd64 only On 32-bit Ubuntu Dapper, I get this output: t.rb---pstree t.rb---pstree Which makes sense to me. But on 64-bit Ubuntu Hardy, I get this: t.rb---sh---pstree t.rb---pstree What's being shown here is that Ruby forks befor...

For ruby/webrick, I need windows to recognize shebang (#!) notation.

(Bear with me, I promise this gets to shebang and windows.) I have about the simplest of WEBRick servers put together: require 'webrick' include WEBrick s = HTTPServer.new(:Port=>2000, :DocumentRoot=>Dir::pwd) s.start Couldn't be simpler. This basic server does accept http connections (firefox, internet exploder, wget, TELENT) and ...

Calling java from PHP exec

Hello, I am doing the following in PHP: exec('java -jar "/opt/flex3/lib/mxmlc.jar" +flexlib "/opt/flex3/frameworks" MyAS3App.as -default-size 360 280 -output MyAS3App.swf'); When I run this from the command line, it runs fine and finishes in a second or two. When I run this command from PHP exec, the java process takes 100% CPU and ...

PHP: exec() error responses?

Below is the command I tried executing, without success: exec('ln -s ' . PLUGIN_DIR . '/.htaccess ' . ABSPATH . '/.htaccess'); When you add a die() at the end, it catches that there's an error: exec('ln -s ' . PLUGIN_DIR . '/.htaccess ' . ABSPATH . '/.htaccess') or die('what?!'); For the above exec() statement, a permissions proble...

Can EXEC master..xp_cmdshell be used on a set of data?

I have a single windows shell command I'd like to run (via EXEC master..xp_cmdshell) once for each row in a table. I'm using information from various fields to build the command output. I'm relativity new to writing T-SQL programs (as opposed to individual queries) and can't quite get my head around the syntax for this, or if it's even...

php exec() error

Hello, I'm having a little problem with the following: When I execute this line: echo exec(createDir($somevariable)); I get this error: Warning: exec() [function.exec]: Cannot execute a blank command in /home/mydir/myfile.inc.php on line 32 Any ideas. Thanks. ...

Append text to stderr redirects in bash

Right now I'm using exec to redirect stderr to an error log with exec 2>> ${errorLog} The only downside is that I have to start each run with a timestamp since exec just pushes the text straight into the log file. Is there a way to redirect stderr but allow me to append text to it, such as a time stamp? ...

illegal command error code 127 in php exec function

I am using this php code: exec("unrar e file.rar",$ret,$code); and getting an error code of illegal command ie 127 ... but when I am using this command through ssh its working ... because unrar is installed on the server ... so can anyone guess why exec is not doing the right stuff? ...

[JAVA] Make application run in its own directory

I'm trying to get an application (a game) to start with a Java script. There is a long explanation behind why, so I'll skip that part. The game won't run unless it is executed from its own directory, IE: Just telling Java to launch the EXE gives errors within the game. It must be launched from its directory. I've Googled for hours over...

External program from our Java program

How can I write a program in Java that will execute another program? Also, the input of that program should be given from our program and the output of that program should be written into a file. This is my small set of code to get its output: Process p = Runtime.getRuntime().exec("C:\\j2sdk1.4.0\bin\\helloworld.java"); BufferedReader ...

Java and unix

I want to delete the old log files in log directory. To delete the log files which are more than 6 months, I have written the script like find /dnbusr1/ghmil/BDELogs/import -type f -mtime +120 -exec rm -f {} \; By using this script i can able to delete the old files. But how to invoke this script by using java? please any one help me....

simple Exec task in a BuildDef (tfsbuild.proj) in TFS and TeamBuild

This does not work (taken from tfsbuild.proj) when queued in BuildExplorer: Builddef for WFPApp1 . . . . . . . but this does (taken from the app1.csproj) and build/rebuild inside the VS IDE csproj for WFPApp1 . . . . . . in the first example, the build just seems to hang indefinitely until cancelled in the Build...

can I include dll in exe (in visual studio) ?

To run my App I need AxInterop.WMPLib.dll and Interop.WMPLib.dll that are located in Debug and Release folder is there any way to include those dlls into exe? so my app is available in one file only. ...

Broken pipes in C -- pipe(), fork(), exec() program

Hello, I need to write a simple program: There will be a Parent and a few programs [children] (started via execl in Parent). Children communicate to one another in this way: Child I sens to Parent number J, Parent sends a message (something like -- "there is a message to you") to J, J send to Parent number K etc. etc. And there is a pr...

problem while running batch file that is present in the remote system

Hi, My requirement is that i need to run batch file that is present in remote system from local machine. i am having the following code. But it is giving the following error :Path not correct". I have the ip address of the machine, and i have given the batch file as public share and share name is dsc. ip address of the machine is 16.18...