51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

shell并发执行脚本

shell并发执行脚本

shell实现多并发控制_shell 多线程并发执行-CSDN博客

#!/usr/bin/env bash
# 2.并发执行(&符号表示{}内的命令将在后台执行,后面的命令不用等前面的命令执行完就可以执行了)
# (wait是将当前脚本进行下的子进程都执行结束,然后在执行后面的语句)
rm -rf /app/ffmpeg/video/11/*

echo -e "并发执行:"
all_num=10
startTime=`date +%Y%m%d-%H:%M:%S`
startTime_s=`date +%s`

for ((j=j;j<=${all_num};j++))
do
{
ffmpeg -i video/f511aa1e-a3f3-4df1-9b44-f3cf0944d2-11/f511aa1e-a3f3-4df1-9b44-f3cf0944d2-11.mp4 -loop 1 -i video/f511aa1e-a3f3-4df1-9b44-f3cf0944d2-11/f511aa1e-a3f3-4df1-9b44-f3cf0944d2-11.png -i gif/hbt.png -filter_complex "[1:v]scale=362:362[img1];[0:v][img1]overlay=(W-362)/2:59:enable='between(t,0,6000)'[out];[out]crop=512:705:0:0,drawtext=text='海之宁静':fontfile=font/sydkm.ttf:fontcolor=white:fontsize=25:x=(w-text_w)/2:y=439,drawtext=text='作词:你好红红火.. 作?:路人饼':fontfile=font/sydkm.ttf:fontcolor=white:fontsize=17:shadowx=1:shadowy=1:shadowcolor=black:x=(w-text_w)/2:y=390:enable='between(t,0,120)'[out2];[2:v]scale=512:704[img2];[out2][img2]overlay=0:0:enable='between(t,117,6000)'" -max_muxing_queue_size 1024 -shortest video/11/ktf511aa1e-a3f3-4df1-9b44-f3cf0944d2-11$j.mp4
}&
done

wait


endTime=`date +%Y%m%d-%H:%M:%S`
endTime_s=`date +%s`
 
sumTime=$[ $endTime_s - $startTime_s ]
 
echo "$startTime ---> $endTime" "Total:$sumTime seconds"
赞(0)
未经允许不得转载:工具盒子 » shell并发执行脚本