Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.

How to run feeding each other processes simultaneously?

Login or Register to Reply

Thread Tools Search this Thread
# 1  
How to run feeding each other processes simultaneously?

I need to run multiple shell processes simultaneously and output of the first process shall be the input of the second process but first process is never ending so both should be running in parallel. I do not wish to wait the end of the first process. I am under ubuntu 16.04. It is the same with wget, downloads 2389.ts file and put it into directory.
ffmpeg -y -re -i http://xx.yy.zz/2389.ts ...some_codes_here.... -f mpegts 2389.ts
tsplay 2389.ts -loop -maxnowait 2 -waitfor 500 -udp

Not giving expected method:
Code: & &

This way, I can't get expected output, because first process is never ending. and second process will always be kept waiting by the first one.

After some research, I found below algorithm but could not make it working.

  ffmpeg -y -re -i "$1" .some_codes_here.. -f mpegts 2389.ts
while IFS= read -r url
        cust_func "$url" &
tsplay 2389.ts -loop -maxnowait 2 -waitfor 500 -udp
done < list.txt
echo "Finished."

But not working... Would Xarg command be a solution ?

Thank you

Sorted by this way:
ffmpeg -y -re -i http://xx.yy.zz/2389.ts .some_codes_here.. -f mpegts 2389.ts > output.log 2>&1 < /dev/null &
tsplay 2389.ts -loop -maxnowait 2 -waitfor 500 -udp


Last edited by baris35; 03-07-2019 at 09:34 PM.. Reason: sorted
# 2  
I'd think this is what pipelines (command1 | command2) are for.
# 3  
Hello Rudic,
I agree with you but unfortunately not working like this way:
command 1 | command2

Somehow, command2 is waiting for the first command to be finished.
Redirection to /dev/null method is okay.

Kind regards
# 4  
Probably because your commands aren't written to work that way.

wget must write to a pipe, not a file, second command must read from pipe, not file, etc, etc, etc.

For wget, that means -O - to make it write to standard output. not sure what that means for ffmpeg, etc. If - doesn't work as an input/output filenames, /dev/stdin and /dev/stdout might.

Last edited by Corona688; 03-08-2019 at 12:29 PM..
This User Gave Thanks to Corona688 For This Post:
Login or Register to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run 2 shell scripts simultaneously from one script

i Run 2 scripts on all of around 50 nodes every day. eg.. i run file with specific node no like NODE_(node number) NODE_(node number) I want to run both file by using single script with unique node number. Eg.. NODE_(node... (11 Replies)
Discussion started by: Ganesh Mankar
11 Replies

2. UNIX for Dummies Questions & Answers

Maximum no of processes that can run

Is there any limit in UNIX that only a MAXIMUM no of processes can run at a time? If so, it exceeds then what would be the error we would receive? (4 Replies)
Discussion started by: jansat
4 Replies

3. Programming

Run two CGIs simultaneously and Ajax to read updated value from CGI1

Flow of program: C based CGI is used CGI1: -Gets called when user hits upload button(submit) ie form action = CGI1 -Does the file upload (copy to a directory etc) JS, Ajax fucntion: -A JS function is called when user hits upload button -The JS function opens an Ajax request for CGI2... (8 Replies)
Discussion started by: xs2punit
8 Replies

4. Shell Programming and Scripting

[Help] script how to run 2 commands simultaneously

#!/bin/sh firefox index.html firefox secondpage.html hey guys, im not able to open up two pages at the same time... it always open up index.html first, and only after i close it, then the 2nd page pops up... is there any way i can run both commands at the same time? i appreciate any... (2 Replies)
Discussion started by: funnyguy123
2 Replies

5. Shell Programming and Scripting

Run a command in bg simultaneously with

Hi, I want to run the command below in the background: tail -f file.txt | grep "pattern" The file file.txt will start getting its contents written after this command has started getting run. So the flow will be like this tail -f file.txt | grep "pattern" #The line below will write data... (0 Replies)
Discussion started by: King Nothing
0 Replies

6. Shell Programming and Scripting

run serveral loops simultaneously?

Hello everyone, say I have the following script, which contains serveral loops, if I run the script, it executes the loop one by one (after the a loop, it goes to b loop, then c, then d) I figured I should be able to run all the loops at same time, but I don't know how, can anyone help a little... (2 Replies)
Discussion started by: fedora
2 Replies

7. Shell Programming and Scripting

Multiple processes writing on the same file simultaneously

Hi All, I have encountered a problem,please help me. I have a script in which multiple processes are writing on to the same file . How should I stop this , I mean lock mechanism can be implemented or we can write the at different files and then concatenate the files. What would be a better... (1 Reply)
Discussion started by: Sayantan
1 Replies

8. UNIX for Advanced & Expert Users

script to run different shells which run different processes

Hi, Would like to ask the experts if anyone knows how to run a script like this: dtterm -title shell1 run process1 on shell1 dtterm -title shell2 run process2 on shell2 cheers! p/s: sorry if i used the wrong forum, quite concussed after watching world cup for several nights; but I... (2 Replies)
Discussion started by: mochi
2 Replies

9. Programming

Run 4-processes concurrently

How can i run a back ground process.... I.e for example by using fork() i need to run seperate 4 background processes.. How can send a process to background ??? (9 Replies)
Discussion started by: ugp
9 Replies

10. UNIX for Advanced & Expert Users

Run away processes

Hi, My server runnning on SUN Solaris rel.5.5.1. I have been facing this issues for years. I have some Xbase databases running on the server. User is using emulation software to telnet to server for accessing application. If user logout application abnormally - by closing windows session, then... (2 Replies)
Discussion started by: lowtaiwah
2 Replies

Featured Tech Videos