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.

4
  • Is there a reason you are not using a proper monitoring solution? Commented Jul 23, 2018 at 9:30
  • What solutions are you referring? Commented Jul 23, 2018 at 10:24
  • one of these: en.wikipedia.org/wiki/Comparison_of_network_monitoring_systems Commented Jul 23, 2018 at 10:31
  • Actually script looks for some configuration files required for an in house developed software Commented Jul 23, 2018 at 10:34

1 Answer 1

-1
zenity --error --text='Something has happened!' --display=:0.0 & while [ -d /proc/$! ];do play /somepath/somefile.wav;done 
2
  • 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 waits or terminates. Commented Jul 23, 2018 at 9:35
  • It worked for me. @kasperd can you provide some elegant solution? Commented Jul 23, 2018 at 10:30

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.