暴力测试音频硬件shell脚本

以下Linux shell脚本用来结音频配件进行暴力测试。如有更好脚本,欢迎提供。

-----------------------------------------------------------------------

#! /bin/sh


while true

do

         aplay /root/test.wav & 

         sleep 8                 # sleep sometime < audio time length

         id=`ps | grep aplay | awk '{print $1}' | head -n 1`   # get the process id

        echo $id                # print the process id 

         kill -9 $id              # kill the aplay process
         sleep 20              # sleep 20 seconds
         sh /root/play.sh  # re-start this scripts

done

-----------------------------------------------------------------------

注:此处为什么用head,因为在buildroot下面,用ps | grep aplay会打印下面信息:

-----------------------------------------------------------------------

# ps | grep aplay
920 root aplay test.wav
922 root grep aplay

-----------------------------------------------------------------------

你可能感兴趣的:(暴力测试音频硬件shell脚本)