We need to use A13 board to play video when GPIO is triggered. So I just wrote a simple script to test the capability of mplayer under the situation of kill and restart.
The script I wrote is pretty simple. Just start mplayer and sleep for a random delay and then kill it. And keep running this process as a indefinite loop.
#!/bin/bash
while true; do
mplayer -fs -ao alsa:device=hw=0.0 /root/Attractor.mp4 </dev/null >/dev/null 2>&1 &
sleep $(( ( RANDOM % 10 ) + 1 ))
ps -ef | grep "mplayer" | awk '{print $2}' | xargs kill -9
done
However, I found that this loop will stop after several hours running and gave an strange error about Xkeyboard. However, when I start Xwindow, it didn't report this error.
XKB: Failed to compile keymap
Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
Fatal server error:
Failed to activate core devices.
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
Please also check the log file at "/var/log/Xorg.0.log" for additional information.
Server terminated with error (1). Closing log file.
/root/stress.test.sh: line 7: 8213 Killed mplayer -fs -ao alsa:device=hw=0.0
Anybody can help me out of this? Thanks in advance...