Executing a sequence of commands as a single background process
I'm writing a PHP script which will take a given media file and convert it into a flash (flv) file. In addition to this, once the flv file has been generated I create two thumbnails (of different sizes) from the newly generated flv file.
In order to do this I'm calling ffmpeg from the command line with the following 3 calls:
1. Generate the flv from the mpg
2. Generate the 'lrg' thumbnail
3. Generate the 'sml' thumbnail
Note that the 2nd and 3rd thumbnail generation commands rely on the output flv file generated by the 1st command.
These commands are all working fine if I execute them individually. However I would like to combine them into a single command which can be executed in the background. The reason for this is to allow me to pass this to the server via the php exec() function.
Searching around I believe I can do this by adding semi-colons between the commands and adding a ampersand to the end of the final command.
I've tried running this directly through the terminal using the following command (this is fairly lengthly...)
When I execute this however, only the first two commands appear get fully executed.
Reading the log file, the final command appears to stop mid-way through.
Can you see what I'm doing wrong here?
thanks for your help
Last edited by phatphug; 10-02-2009 at 11:27 AM..
Reason: Clearer formatting
The &&'s had the same problem as the brackets.
It did work when running via a script though.
Strangely, when calling exec() in php with brackets around the 3 commands they do work. I'm not sure why the same doesn't work in terminal, but since I only need a working solution in php, this will do me.
Hi,
I have written a menu driven shell script in which as per the choice, I run the another script on background.
For eg:
1. get info
2)process info
3)modify info
All the operations have different scripts which i schedule in background using &.
However I wish to display the error... (0 Replies)
Greetings, i've been working with a user-friendly menu on ksh to allow users execute scripts located on a remote server, so they wont have to login and manually launch those scripts every single time.
This is a HP-UX box and currently on a /usr/bin/ksh shell.
I've setup ssh keys on both... (1 Reply)
Hi,
I am using net::ftp for transferring files now i am trying in the same Linux server as a result ftp is very fast but if the server is other location (remote) then the file transferred will be time consuming.
So i want try putting FTP part as a background process. I am unaware how to do... (5 Replies)
Somebody on a thread in the (french) Mandriva Forum recently suggested a script, designed to provide a tool to display kind of "temporisation widgets" on the console (to be ultimately pasted in other more complex scripts).
One version of this script was something like the following, which seems... (6 Replies)
Guys
I'm working to make in AIX script and I have some commands need to be excited by that script
Like the below commands ...
startsrc -s sshd
I want that executing to be in the background of the system I do not like to see the out put of that (3 Replies)
Hi
I have this script:
#!/bin/ksh
cmd1 | cmd 2 |cmd 3| cmd4
which it creates 4 process....
Is possible to create a single process PID1 which include all commands?
Thanks
Israel (2 Replies)
My file looks like this (60 characters per line):
But I need something like this (the entire sequence in one line):
The sequences are of different lengths.
Any help will be very much appreciated! (21 Replies)
What I need to learn is how to use a script that launches background processes, and then kills those processes as needed.
The script successfully launches the script. But how do I check to see if the job exists before I kill it?
I know my problem is mostly failure to understand parameter... (4 Replies)
Hello all,
How do I start a background process and save the process id to a file on my system. For example %wait 5 & will execute and print the process id. I can't figure out how to get it to a file. I've tried: > filename 0>filename 1>filename.
Any assistance is most appreciated.
Thanks,
Jim... (10 Replies)