Hello,
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.
First_process.sh: 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
Second_process.sh:
tsplay 2389.ts -loop -maxnowait 2 -waitfor 500 -udp 234.5.5.5:5000
Not giving expected method:
First_process.sh &
Second_process.sh &
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.
list.txt:
http://xx.yy.zz/2389.ts
final.sh
#!/bin/bash
cust_func(){
ffmpeg -y -re -i "$1" .some_codes_here.. -f mpegts 2389.ts
}
while IFS= read -r url
do
cust_func "$url" &
tsplay 2389.ts -loop -maxnowait 2 -waitfor 500 -udp 234.5.5.5:5000
done < list.txt
wait
echo "Finished."
But not working... Would Xarg
command be a solution ?
Thank you
Boris
Edit:
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 234.5.5.5:5000
Thanks
Boris