I did a simple alert script in
bash. On my RPi
nclistens on some port. When somebody (some other RPi or PC) sends a message to this port,
nc finishes and
omxplayer plays a sound. Then the loop repeats. What have looked easy, appeared to be a problem when it should run many months without a hangup. I have solved a rare hangup of
nc (by a timer with cyclic kill and restart
nc within a script).
But what I cannot solve is that omxplayer rarely hangs when supposed to play a sound (approx. once a week) and
kill -9 omxplayer.bin does not help. I tried
mpg321 instead and I ended with the same problem, maybe a little more frequent.
One thing I observed - when I managed to kill the
omxplayer.bin process (by killing the parent), all the sounds that were waiting (I mean that were sent to the soundcard after) were played immediately one by one.