Skip to content

Instantly share code, notes, and snippets.

@karthikeyan-mac
Last active June 15, 2023 15:31
Show Gist options
  • Save karthikeyan-mac/463d70190f7b4688bf3e5e10aa1f9697 to your computer and use it in GitHub Desktop.
Save karthikeyan-mac/463d70190f7b4688bf3e5e10aa1f9697 to your computer and use it in GitHub Desktop.
Check Dock Status and wait for it to load
#!/bin/bash
#
# Script to check and keep looping till the Dock is loaded
# This can be used to launch or execute app or script after the Dock loads.
#
#
dockStatus=$(pgrep -x Dock)
echo "Waiting for Dock to launch"
while [[ "$dockStatus" == "" ]]
do
echo "Dock is not loaded. Waiting"
sleep 5
dockStatus=$(pgrep -x Dock)
done
sleep 5
loggedinUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }')
echo "Dock loaded with $dockStatus for user $loggedinUser"
#
# Add your scripts or commands here to execute after the Dock is loaded
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment