exec

To cut flv video using php

I am trying to provide a preview of 30 seconds of premium videos (users have to pay to watch it completely). So I want to create a video file of 30 seconds at the time of uploading these videos. I used ffmpeg as below, but it is not working. ffmpeg -ss 00:00:00.0 -t 00:00:30.0 -i input.flv -acodec copy -vcodec copy -async 1 output.flv ...

How can I know the error in command in an exec function

I am using a ffmpeg command to cut a video with exec function in php. But it is not creating a video file and doesn't show any errors. I used exec as below exec("ffmpeg -i input.flv -ss 00:00:30.0 -t 00:00:10.0 -acodec copy -vcodec copy -async 1 output.flv"); Can I get any help to know what is the error happening here. exec("ffmpeg -i...

Running shell script from PHP as different (non root) user

I'm trying to run a shell script owned by a non-privileged user from PHP on an Ubuntu server. Issues with permissions make running it with exec() impractical, as it's www-data that's running it. I've googled a bit and found varius references to suExec (which seems too much of a hassle to get working for such a small problem), setting the...

converting tiff files to jpg from php

Hi, I am trying to convert a folder of tif files to jpeg so they can be displayed on my website. my current approach is not working. i wrote a perl script with #!/usr/bin/perl opendir(DIR, $ARGV[0]); @files = readdir(DIR); closedir(DIR); foreach $file (@files){ if($file =~ /(.*?)\.tif/){ print "converting $file\n"; `convert -au...

ls -ltr using PHP exec()

as the problem states.. when i do exec("ls -ltr > output.txt 2>&1",$result,$status); its different from the normal output. An extra column gets added. something like -rw-r--r-- 1 apache apache 211 Jul 1 15:52 withoutsudo.txt -rw-r--r-- 1 apache apache 0 Jul 1 15:53 withsudo.txt where as when executed from the comma...

Problem formatting a find with sed output

Hi I'm trying to clean a site from a js-trojan for a customer, it has added: <script src='http://nt02.co.in/3'&gt;&lt;/script&gt; to all html-pages. Since it's too many files to manually clean I tried to a do find like this: find ./ -type f -exec sed -e "s\<script src='http://nt02.co.in/3'&gt;&lt;/script&gt;\ \g" {} > {} \; Problem ...

Java Runtime.getRuntime().exec() with quotes

I am trying to run ffmpeg via the exec call on linux. However I have to use quotes in the command (ffmpeg requires it). I've been looking through the java doc for processbuilder and exec and questions on stackoverflow but I can't seem to find a solution. I need to run ffmpeg -i "rtmp://127.0.0.1/vod/sample start=1500 stop=24000" -re -...

ANT Execute failed: java.io.IOException: Cannot run program "cp ": java.io.IOException: error=2, No such file or directory

I'm trying to use ANT to copy files from one directory to another directory on Linux. Firstly I used copy task, it works fine but the file mode is not preserved. Then I changed to use , and that's where I got stuck. My target is like: <target name="test"> <echo message="${basedir}"/> <exec executable="cp " os="Linux" spawn="ye...

exec doesn't work correctly with stderr

I'm trying to execute some program: exec -ignorestderr "bin/tecs-software-suite-2.5/JackCompiler.bat" "$current_file" the program writes to the stderr, so tcl shows an error dialog similar to it's ordinary errors. I don't want that, I simply want it's error output(all it's output) to be in a TK label. I added an ignorestderr but it do...

How to get the error from exec?

I am executing a.jar file from PHP through Command Line. However, if there is any error/exception, the error is not being displayed. I am using the following PHP script. <?php exec('java -jar D:\\ABC\\JavaApplication2\\dist\\JavaApplication2.jar', $result, $returnCode); var_dump($result); $count = count($result); for($i=0; $i<$count;$i+...

Executing GPGPU program through WAMP

Hi, I have a program that uses the GPU for performing certain computations. I can get the program to run correctly using the command line. But when i try to execute the same statement through PHP, i run into trouble. I'm using wamp 2.0, and I've tried the exec and proc_open functions to try to get the program to run, but even though th...

tcl: capture output from "exec diff" which returned non-zero

Hi, I know it is common to use catch when executing commands that may return non-zero... but how can I get the output in that case? To be specific, I wish to do something like "catch {exec diff fileA fileB} ret". The files are different and ret value is 1. What I actaully need is the output of diff, the detailed differences. But I bel...

Spawn a process with php doesn't work

Hi, I tried to start a background process with php, for that, I added a & at bottom on exec function but after a few days it stop working. Basically If i have file 1.php with: <?php var_dump(exec('/home/2.php > /home/2.output 2>&1 &')); And file 2.php with: <?php sleep(5); echo "Fill\n"; Running file 1.php, it return an empty st...

Cron job in cPanel to Delete Emails after 21 days

I'm having some issues with a cron job to delete emails after 21 days. I've read through many examples and have tried many different variations of this command but I can't get it to work: find /home/cont/mail///cur -name "*" -mtime +21 -exec rm {} \; Currently this runs and I get a message back from every mail box that doesn't have any...

bash: force exec'd process to have unbuffered stdout

I've got a script like: #!/bin/bash exec /usr/bin/some_binary > /tmp/my.log 2>&1 Problem is that some_binary sends all of its logging to stdout, and buffering makes it so that I only see output in chunks of a few lines. This is annoying when something gets stuck and I need to see what the last line says. Is there any way to make stdo...

passing URL variables to exec() with php

I have a dedicated server that I use to crunch lots of data. The way I have it now, I can open a script with a process ID like example.php?ex_pid=123 and just let it go. It downloads a small portion of data, processes it, then uploads it into a database then starts again. Ideally, I would like to call example.php?ex_pid=123 directly and...

Python fork-exec problem, child process output goes to same place as parent process.

Try the code below with: python fork.py and with: python fork.py 1 to see what it does. #!/usr/bin/env python2 import os import sys child_exit_status = 0 if len(sys.argv) > 1: child_exit_status = int(sys.argv[1]) pid = os.fork() if pid == 0: print "This is the child" if child_exit_status == 0: os.execl('/usr/bin/w...

Exec real world example

Hi All, I am looking for a real world scenerio where using exec will be the only availble option ( The problem could not be solved if exec is not used) I know what is exec and how it differs from fork, but still intrested in real world problem that enforce the use of exec command. ...

Simultaneous eval and exec

Is there a way to get python to do an evaluation and execution on a string? I have a file which contains a bunch of expressions that need to be calculated, maybe something like this. f1(ifilter(myfilter,x)) f2(x)*f3(f4(x)+f5(x)) I run through the file and eval the expressions. Some of the expressions may want to save their work afte...

exec code in original local scope of frame

I've written a remote Python debugger and one of the features I need is to execute arbitrary code while stopped at a breakpoint. My debugger uses the following to execute code received from the remote debugger: exec (compile(code, '<string>', 'single') , frame.f_globals, frame.f_locals) This works fine for the most part, but I've noti...