1

I have a shell script running in crontab to perform certain checks. In case of any problem I want to alert user. For that purpose I am using zenity and play command

zenity --error --text='Something has happened!' --display=:0.0   // for pop up
play /somepath/somefile.wav                                      // for sound

These two are working fine independently. But I want to play the alarm until zenity error is acknowledged. After searching in internet I found zenity does not have audio alarm inbuilt support. I want to know how to achieve my goal. Any other solution is also ok if it is not a third party solution.

Sush
  • 13
  • 2

1 Answers1

-1
zenity --error --text='Something has happened!' --display=:0.0 &
while [ -d /proc/$! ];do play /somepath/somefile.wav;done
Ipor Sircer
  • 1,226
  • 7
  • 8
  • This could do with some explanation. Also it won't work without `&`. Finally this is highly dependent on how the shell implements its `wait` calls. So I'd worry if a minor implementation change of the shell in the future would cause it to stop working. You are not explicitly calling `wait` you are relying on the shell doing it implicitly. If the shell didn't do that you'd be looping forever waiting for a zombie to go away, meanwhile the zombie will stay around until the parent `wait`s or terminates. – kasperd Jul 23 '18 at 09:35
  • It worked for me. @kasperd can you provide some elegant solution? – Sush Jul 23 '18 at 10:30