I use the alarm-clock-applet when doing work. When the timer ends, I have it run a script. The script does two things: 1) Give an on-screen notification and 2) Plays an audio clip.
The notification-daemon is not always running. So, if it is not running, I want to start it before trying to pass the on-screen notification.
To this end, I have the following:
#!/bin/sh if ! pgrep -f "notification-daemon" > /dev/null ; then /usr/lib/notification-daemon/notification-daemon & fi notify-send "Take 5" aplay /home/Me/Music/brubek-clip.wav
The trouble is that on the first run, the notification does not appear. The daemon has been started successfully and subsequent runs of the script function as expected.
When I put a
sleep 0.5 after the call to the
notification-daemon, the notification appears on the first run. But this seems rather crude.
Is there a way to check that the notification-daemon has started before continuing?