Questions tagged [exec]

This tag refers to the starting of another, subsidiary program. It is named after the family of POSIX system calls whose name starts with “exec” (notably “execve”) though similar concepts exist on other platforms as well, especially when combined with the starting up of another process.

exec
Filter by
Sorted by
Tagged with
1 vote
1 answer
2k views

Implementation of Bakery Algorithm in C for forked processes

So, I'm new to shared memory and the shm functions in C. I've got two programs; master and slave. In the most general sense: the master program creates a sharedNum integer in shared memory and forks ...
Anthony's user avatar
  • 11
1 vote
0 answers
122 views

ffmpeg command is not run when I hit using exec function in php

I have to convert some video to "h264" using FFmpeg.When I hit the below command as a cloud user with ssh login it converts successful. ffmpeg -i /var/www/media/photos/video_demo/55291482115655.MP4 -...
Gourav's user avatar
  • 21
1 vote
1 answer
239 views

How should I invoke shell_exec or exec in php if I want all the commands to be run on same shell instance and not on different instances everytime?

I am searching on one topic for nearly a week now and still cannot find a proper answer on the Internet. What i want to do is make multiple shell_exec or exec commands via my server which is running ...
Soumyajit Dutta's user avatar
1 vote
0 answers
1k views

Exploit execvp() with alias

For a class assignment we must exploit a program and gain shell access. I have acess to the source and there is a line similar to execvp("mkdir", "directory", null); I am currently using a custom ...
lufthansa747's user avatar
  • 1,973
1 vote
1 answer
55 views

phpmysql dump not working if password has "(" or ")" or "&"

I am trying to do a mysql dump and I am having issues when the database password has either "(" or ")" or "&" in it. There may be more but till now I have tested with these characters. My script ...
Yunus Aslam's user avatar
  • 2,467
1 vote
1 answer
504 views

exec() disabled, how to execute .jar file

PHP's exec() function is turned off in my hosting server and it's not possible to change it (for security reasons). Are there alternatives for the exec() function? Here is more info about my problem: ...
Skyluk's user avatar
  • 59
1 vote
0 answers
50 views

print_function imported inside exec does not affect code afterwards

(Python 2.7) Normally when I exec a python statement, the global dict is in the updated state after the execution. For example, in the following code, the numpy will be in globals after the execution, ...
shaoyl85's user avatar
  • 1,904
1 vote
0 answers
360 views

php exec() doesn't execute but output works

I'm basically making a webpage that can play spotify music on my computer using a Mac spotify api. You access it by typing spotify <command> on command line, and I got it to work perfectly in my ...
Jamsheed Mistri's user avatar
1 vote
1 answer
87 views

Uppercase letters first in exec sort

I am doing an exercise where I must pass a file into a pipe sort the file with exec sort and print it . My problem is that the results are not exactly as I want them . My Infile Data is this . ...
S.Kyriakos's user avatar
1 vote
1 answer
541 views

how to wait an exec finishes to write in pipe in C

I'd like to know how to wait for my exec finish to write in an fd before use it? The problem is the fact that not all of my exec is wrote in the pipe. So when I get the answer, not all of the exec is ...
Vincent Normand's user avatar
1 vote
1 answer
969 views

Trouble with pipes, dup, close and exec in C

Well. I kinda understand how pipes work and why is dup/dup2 used before an exec in any child process. But I need help with the 'close(int fd)' thing. To make it clear I would like to ask you for any ...
xBurnsed's user avatar
  • 420
1 vote
1 answer
940 views

How to start/stop Tomcat as a windows service from a Java program rather than just from a .bat? [duplicate]

I know how to start/stop Tomcat from a Java program using BAT files (and .sh files in linux/unix). it's done like this: String command = "c:\program files\tomcat\bin\startup.bat";//for linux use .sh ...
Binyamin Regev's user avatar
1 vote
0 answers
35 views

Weird waitpid behaviour

Assume I have the following code. int main(int argc, char* argv[]) { char* program[3] = {"/bin/ls", NULL, NULL}; pid_t pid = fork(); if (pid == 0) { char* envp[1] = {NULL}; execve(...
insumity's user avatar
  • 5,391
1 vote
0 answers
738 views

exec() using different php version

I'm using Mac OS X (10.11.6) with MAMP PRO 3 and PHP 5.6.10. I've setup the PATH in .bash_profile and everything looks fine. When I do which php in the terminal I get the following correct path: /...
NthDegree's user avatar
  • 1,341
1 vote
1 answer
200 views

Execute external application and exit

I am running ActiveState perl 5 on win7 x64. The solution does not have to be cross-platform. I'm trying to use a Perl script to build a somewhat complex and variable command line argument string for ...
tstevens's user avatar
1 vote
1 answer
73 views

Is this an efficient way to concurrently process files in linux programming?

I want to process different files simultaneously. My program will get the first argument which is a file which contains names(absolute paths) of different files on my pc and the second argument the ...
posixKing's user avatar
  • 408
1 vote
1 answer
547 views

How to call Python function in PHP passing variable argument

I'm calling the function using 'exec' and defining the argument as a variable. $jsonrequest = escapeshellarg(json_encode($request, JSON_NUMERIC_CHECK)); $solveroutput = exec('sudo python /var/www/...
Luiggi Senna's user avatar
1 vote
1 answer
61 views

How can i get the error message from a chain of exec commands which emit errors to stdout

In my searches I've found many examples of how to retrieve the stdOut error for a single exec command but I'm struggling with a whole chain of the things. In my actual code I have 5 exec processes ...
SwiftD's user avatar
  • 5,949
1 vote
0 answers
1k views

execute a function with exec php

I need to execute a function using exec command in php. I have this: exec("php ./myfile.php >> ./log.txt &"); But I want to execute an specific function "myFunction" in myfile.php How could I do ...
learango's user avatar
  • 153
1 vote
0 answers
189 views

How Can I Intercept Exec Calls in Linux?

tl;dr: I'm hoping to wrap all application executions with something that checks Caps Lock, and depending on its state, either let's the application pass through as normal, or pass the executable (and ...
Caleb Gray's user avatar
  • 3,060
1 vote
1 answer
748 views

Pass table variable to exec SQL Server

I am trying to write this stored procedure but I have trouble passing result of temp table (or table variable) to EXEC (@SQL) task: DECLARE @colsUnpivot AS NVARCHAR(MAX) DECLARE @query AS ...
nick's user avatar
  • 333
1 vote
0 answers
560 views

PHP5 - simple write to file 500 error with cgi-bin. Code validated and .PHP file set to 755

I am running a server on Debian, using php-5 My php file is called pwrite.php, has 755 rights and is located at: /usr/lib/cgi-bin <?php $myfile = fopen("newfile.txt", "w") or die("Unable to ...
Finn Geraghty's user avatar
1 vote
1 answer
342 views

node.js child_process doesnt work

currently I am working on an automatic docx2pdf converter in node.js. I am using unoconv. When i run this command in the shell in works pretty well: unoconv -f pdf "/opt/bitnami/apache2/htdocs/123....
t333o's user avatar
  • 39
1 vote
0 answers
804 views

Is exec async or sync?

I am trying to figure out why my script doesn't wait until the completion of this command before moving on to the next thing. exec('env MAGICK_THREAD_LIMIT=1; convert -density 72 '.$tempPath.'/'.$...
chris's user avatar
  • 36.5k
1 vote
0 answers
41 views

PHP shell_exec not working perfectly [duplicate]

I add user with right permission in this file: /etc/httpd/conf/httpd.conf But shell_exec,system,exec can't run all command. For example I can go to root folder and get list of files and directory in ...
user6790106's user avatar
1 vote
0 answers
527 views

Java - How to keep track of "javaws" process when started programmatically?

I know how to start "javaws" (Java Web Start) from a Java program, but I have problems tracking the process instance after created. The JNLP file used as parameter contains the definition of a ...
David's user avatar
  • 1,302
1 vote
1 answer
737 views

Reading stdout/stderr from an exec()'ed process in a daemon

I have a daemon process where I need to fork()/exec() some new processes and then read the child processes stdout/stderr. My problem is that the parent is a daemon where stdout and stderr are ...
devin's user avatar
  • 6,437
1 vote
0 answers
43 views

Is that possible to use Yii2 + MySql in Rapache server?

I have yii2 project and use R code for report and image generation. I use PHP exec() + Rscript for now. But it has some issue like ONLY ONE USER can be using the web app at a time. i try use PHP exec(...
Galang Re's user avatar
  • 224
1 vote
1 answer
265 views

php exec() Linux server strange output

I am attempting to backround a php script since it will take more than a minute to complete and I do not want the user to wait. my exec command is as follows: exec ('php -f path/to/file.php > ...
electricjelly's user avatar
1 vote
2 answers
260 views

PHP shell exec command

I am using a windows application tesseract, long story short this is an OCR application which runs through command. After installing the application i used command to test and works fine using this ...
Combinu's user avatar
  • 872
1 vote
1 answer
2k views

Python script is killed from within, but the process doesn't die

I'm trying to execute a python script using php with an exec command like this: exec("python /address/to/script.py"); I don't need the script to run to completion, so after it does what I need, I ...
DaiBu's user avatar
  • 529
1 vote
0 answers
86 views

PHP Nested escapeshellarg()

I am using PHP to generate a shell command that I then pass to PHP's exec() function. I am extensively using escapeshellarg() to make sure there aren't any security issues and also to ensure that ...
Bradley Odell's user avatar
1 vote
0 answers
689 views

windows php exec apache

windows 10, php 5.6 as mod, apache 2 service in browser i dont see that exec() return any value <?php exec("python c:\script.py", $output); var_dump($output); if i change the command from using "...
Eugene's user avatar
  • 1,710
1 vote
2 answers
931 views

How to pass parameters to function when calling with "exec" in bash script

I am working on a script to create a clearcase view and perform some other functions. In the setview function, when used inside a script, for performing operations on the view, the recommended ...
adbdkb's user avatar
  • 2,051
1 vote
1 answer
273 views

Php exec is not running properly when called from Java on localhost

I have a problem running the exec command from within a php script. here's the detailed scenario: I have an executable my_exe which runs from command line. This executable uses an environment ...
h_djebli's user avatar
  • 2,569
1 vote
1 answer
538 views

How can I call shell_exec() from PHP webhook?

I'm having a major issue and I can't find a solution. I currently have a PHP script that accepts a webhook (HTTP POST) as a trigger. Based on variables contained in the POST, an exec('python script') ...
Samson's user avatar
  • 75
1 vote
1 answer
756 views

echo user input to terminal with php exec();

I just got a LAMP server this morning and i'm playing around with it. I have the php file: <?php $input = $_REQUEST["input"]; exec("echo " . $input); ?> this has $input sent to it from ...
James Oswald's user avatar
1 vote
0 answers
874 views

execute php script with exec() in php-fpm pool

Webserver is configured as php-fpm pool per site configuration. I am tryin to get my php "kind-a" asynchronous by using php exec('bash -c "exec php index.php" > /dev/null 2>&1 &') I ...
user2441190's user avatar
1 vote
1 answer
3k views

C Redirecting stdout to a file for process called by exec in child process

I am unable to redirect STDOUT to a file. I have two processes. These should run for 5 seconds and then be killed. Process 1: redirects its STDOUT to a pipe and then prints random nubers. Process 2:...
Jura Brazdil's user avatar
  • 1,010
1 vote
1 answer
98 views

rdiff-backup java runtime exec remote multi args issues

I must execute rdiff-backup commands in Java. I desesperatly try to execute a backup command from local to remote with Runtime. I need to use a remote schema because I can't connect to standart port ...
Greg B's user avatar
  • 13
1 vote
0 answers
166 views

Running VBS script from PHP to convert ppt into pdf not saving file into design target

i have VBS script which convers .ppt file into .pdf file (script will be shown below). And i have two shared network drives. From one i need to load input data and to second i wana save output file. ...
Luboš Suk's user avatar
  • 1,536
1 vote
1 answer
470 views

Why Linux command dmidecode when use in exec returns nothing?

If run command "dmidecode -s processor-frequency" in the terminal, it displays information: 2000 MHz. But when I run a PHP script: exec("dmidecode -s processor-frequency", $output); print_r($output); ...
Nazar Vozniy's user avatar
1 vote
1 answer
206 views

AJAX Script doesn't respond until background program ran with exec() ends

I run a background PHP program with exec() like this : exec('/usr/bin/php bgScript.php "arg1" "arg2" > /dev/null 2>&1 &'); It works and the program does run in background. Problem I ...
Subin's user avatar
  • 3,493
1 vote
1 answer
579 views

Golang - why is string slice element not included in exec cat unless I sort it

I have a slightly funky issue in golang. Essentially I have a slice of strings which represent file paths. I then run a cat against those filepaths to combine the files before sorting, deduping, etc. ...
SwiftD's user avatar
  • 5,949
1 vote
0 answers
94 views

Redirecting STDERR and STDOUT to a log file when script is executed via php

I have a scenario where a php file runs a perl script file using exec function. I want STDOUT and STDERR to be redirected to a log file which can then be read via ajax call to another php file. ...
Joel G Mathew's user avatar
1 vote
1 answer
107 views

Calling a Python Script from PHP

I am trying to call a python script from my PHP page but no output is being delivered. Is there any error in code ? <?php include('main.php'); $lat = $_POST['lt']; $lon = $_POST['ln']; $uid = $...
Hemant Pandey's user avatar
1 vote
1 answer
378 views

Running Shell commands through java

I am trying to run cmd commands through java. Commands like 'explorer', 'notepad' are running, but commands like 'dir' 'path' are not working it is throwing exception, output says:- Problem in ...
Ankit's user avatar
  • 138
1 vote
1 answer
245 views

Can we Switch between process called by fork() C,like Switch player

for example i'm using fork to call 4 player.c as a child and want to create board game,and after each player finish the turn, program gonna pause that player.c and switch to another it's gonna repeat ...
Karos papermoon's user avatar
1 vote
0 answers
128 views

Executing php script in terminal will not work on OSX but works in Linux

I have a script that uses php exec() function to run a command. It works fine in linux but not in OSX The scripts are massive so i'm only showing relevant code: sim.php: $rootDir = dirname(__DIR__);...
Jay Povey's user avatar
  • 137
1 vote
0 answers
192 views

PHP automatically log the output of exec()

We have an inside tool in my workplace where a lot of colleagues create short php scripts. Almost every script contains a call of exec() function to run python scripts. I would like to log everything ...
Levente's user avatar
  • 161

1
52 53
54
55 56
120