This file contains 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 | |
# based on http://tyhoffman.com/blog/2013/09/sleepwatcher-power-event-driven-automation/ | |
# forked from eu81273/sleepwatcher.sh | |
# updated for SleepWatcher version 2.2.1 | |
# acquire sudo at the beginning | |
sudo -v | |
# keep-alive: update existing `sudo` time stamp until `.osx` has finished |
This file contains 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 | |
# updated version based on http://tyhoffman.com/blog/2013/09/sleepwatcher-power-event-driven-automation/ | |
# acquire sudo at the beginning | |
sudo -v | |
# keep-alive: update existing `sudo` time stamp until `.osx` has finished | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & |