You could try using a while-loop to wait for the service to launch:

<!-- language: bash -->

 #!/bin/sh

 # If the notification daemon isn't running then launch it
 if ! pgrep -f "notification-daemon" > /dev/null; then
 /usr/lib/notification-daemon/notification-daemon &
 fi

 # Wait for the notification daemon to finish launching
 while ! pgrep -f "notification-daemon" > /dev/null; do

 # Set optional delay
 sleep 0.1

 done

 # Play awesome song (do-doop da-doop doop-doop-doop...)
 notify-send "Take 5"
 aplay /home/Me/Music/brubek-clip.wav

This should guarantee that you don't continue until the daemon is running (e.g. if for some reason it takes longer than your 0.5 second sleep).

I did a little bit of web-searching for similar posts and found a few that seem relevant:

- https://unix.stackexchange.com/questions/5277/how-do-i-tell-a-script-to-wait-for-a-process-to-start-accepting-requests-on-a-po

- [Bash wait for process start
](https://stackoverflow.com/questions/19326245/bash-wait-for-process-start)

- https://unix.stackexchange.com/questions/240208/shell-script-to-process-service-restart-procedure

- https://unix.stackexchange.com/questions/103862/how-do-i-wait-on-a-program-started-in-another-shell

These all seem to follow the same basic approach - use a loop to wait until the desired condition is met.

**UPDATE:** It turns out that waiting for the process to start isn't sufficient. In this case you need to wait for the service to become available. You may want to look at the following posts:

- [How do I run a script on a dbus signal?](https://askubuntu.com/questions/150790/how-do-i-run-a-script-on-a-dbus-signal)

- https://unix.stackexchange.com/questions/46301/a-list-of-available-dbus-services

- https://unix.stackexchange.com/questions/80143/how-to-create-a-daemon-which-would-be-listening-to-dbus-and-fire-script-on-messa

- [Is there a way to show notification from bash script in Ubuntu?](https://superuser.com/questions/31917/is-there-a-way-to-show-notification-from-bash-script-in-ubuntu)