Skip to content

Instantly share code, notes, and snippets.

@yaotti
Created January 20, 2011 11:56
Show Gist options
  • Save yaotti/787790 to your computer and use it in GitHub Desktop.
Save yaotti/787790 to your computer and use it in GitHub Desktop.
make MacOS sleep after some command will be finished
#!/bin/zsh
# $ sleep-on-finish.sh backupd # go sleep after finished backupd
CMD=$1
while `pgrep $CMD > dev/null`; do
sleep 10
done
echo "Finished $CMD"
osascript -e 'tell app "Finder" to sleep'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment