Skip to content

Instantly share code, notes, and snippets.

@adnansky
adnansky / sleepwatchersetup_2.1.1.sh
Last active November 30, 2021 22:44
SleepWatcher version 2.2.1 installation script for macOS
#!/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
@adnansky
adnansky / sleepwatcher.sh
Last active November 30, 2021 21:49 — forked from eu81273/sleepwatcher.sh
sleepwatcher installation script for macOS
#!/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 &