WD の Mybook っていう安い外部USBドライブが有るんですがそいつがしょっちゅうスリープしちゃうので、強制的に起こす奴。
# Place files in your home dir. (~/.scripts/***)
# Registration
launchctl load wd_block_sleep.plist
# Check
launchctl list -x | grep BlockSleep
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>info.levolution.wdBlockSleep</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/bin/sh</string> | |
<string>/Users/USER/.scripts/wd_block_sleep.sh</string> | |
</array> | |
<key>StartInterval</key> | |
<integer>180</integer> | |
<key>RunAtLoad</key> | |
<true/> | |
</dict> | |
</plist> |
#!/bin/bash | |
volpresent=$(mount | grep VOLUME | wc -c) | |
if [ $volpresent -gt 0 ] | |
then | |
touch /Volumes/VOLUME/.blocksleep | |
fi |