我想播放一个音频文件,然后在音频文件播放完毕后,等待30分钟,并让它再次播放音频文件。我想做几次。
我知道我可以制作一个很大的音频文件,但是这个文件会非常大,我需要给其他人发电子邮件,制作音频文件和使用某种类型的脚本来完成这个任务比较容易。
Example Loop:
play audio file to the end then wait 30mins,
play audio file to the end then wait 30mins,
play audio file to the end then wait 30mins,
etc..PS:音频文件可以是任意长度的.
我知道crontab的事
crontab -e
*/30 * * * * /path/to/your/command但这不需要等待音频文件完成播放,或者让我能够说出它应该运行多少次。
我用的是ubuntu 14.04
发布于 2015-11-16 14:08:17
很简单,否则我遗漏了什么。你需要的是:
NTIMES=5
count=0
while [ $count -lt $NTIMES ]
do
mplayer the_sound_file
sleep 1800 # 1800 seconds == 30 min
count=`expr $count + 1`
done我使用了较早的语法,这样就可以在任何类似bourne的shell上运行(而不仅仅是bash)。
https://stackoverflow.com/questions/33736504
复制相似问题