Skip to main content
added 714 characters in body
Source Link
igal
  • 10.3k
  • 4
  • 45
  • 60

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

#!/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:

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:

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

#!/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:

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

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

#!/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:

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:

deleted 2 characters in body
Source Link
igal
  • 10.3k
  • 4
  • 45
  • 60

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

#!/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 & donefi # 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:

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

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

#!/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 & done # 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:

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

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

#!/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:

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

added 653 characters in body
Source Link
igal
  • 10.3k
  • 4
  • 45
  • 60

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

#!/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 & done # 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:

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

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

#!/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 & done # 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).

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

#!/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 & done # 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:

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

added 684 characters in body; deleted 558 characters in body; added 53 characters in body
Source Link
igal
  • 10.3k
  • 4
  • 45
  • 60
Loading
Source Link
igal
  • 10.3k
  • 4
  • 45
  • 60
Loading