Last active
June 15, 2023 15:31
-
-
Save karthikeyan-mac/463d70190f7b4688bf3e5e10aa1f9697 to your computer and use it in GitHub Desktop.
Check Dock Status and wait for it to load
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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