With this instruction all work:
If not have directoris:
$ sudo mkdir -p /usr/local/sbin /usr/local/share/man/man8
Copy:
$ sudo cp sleepwatcher /usr/local/sbin
$ sudo cp sleepwatcher.8 /usr/local/share/man/man8
Copy and load the launch script to make sure SleepWatcher starts on boot:
sudo cp config/de.bernhard-baehr.sleepwatcher-20compatibility.plist /Library/LaunchDaemons/de.bernhard-baehr.sleepwatcher.plist
sudo launchctl load -w -F /Library/LaunchDaemons/de.bernhard-baehr.sleepwatcher.plist
Swears at security, we allow it in System settings.
You can then add your scripts to /etc/rc.wakeup and /etc/rc.sleep:
sudo touch /etc/rc.wakeup
sudo touch /etc/rc.sleep
sudo chmod +x /etc/rc.sleep /etc/rc.wakeup
Edit rc.wakeup and add script:
#!/bin/sh
for user in `echo 'show State:/Users/ConsoleUser' | scutil | awk '/kCGSSessionUserNameKey/ { print $3 }'`; do
home=`eval echo ~$user`
if [ -x "$home/.wakeup" ]; then
logger -t $0 "executing .wakeup of user $user"
su - $user -c "\"$home/.wakeup\""
fi
done
sleep 5
pkill bluetoothd
At me work!