Created
October 5, 2015 15:12
-
-
Save rshev/f67635afd98c01f12322 to your computer and use it in GitHub Desktop.
Sleep and remount scripts for use with SD cards on MBPr
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/sh | |
volumeName="sdextend" | |
volume=`mount | grep "$volumeName" | sed 's/.*\(disk[0-9]s.\).*/\1/'` | |
if [ -n "$volume" ]; then | |
# force quit apps here | |
/usr/sbin/diskutil unmount force $volume | |
/usr/sbin/diskutil eject $volume | |
fi | |
sudo kextunload -b com.apple.driver.AppleUSBCardReader | |
exit 0 |
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/sh | |
volumeName="sdextend" | |
function check() | |
{ | |
var=`mount | grep "$volumeName"` | |
if [ -n "$var" ]; then | |
#open /Applications/Dropbox.app | |
exit 0 | |
fi | |
} | |
sleep 5 | |
check | |
var="" | |
i=0 | |
while [ $i -lt 10 ] && [ -z "$var" ] | |
do | |
sudo kextunload -b com.apple.driver.AppleUSBCardReader | |
sudo kextunload -b com.apple.driver.AppleUSBStorageCoexistentDriver | |
sudo kextunload -b com.apple.iokit.IOUSBMassStorageDriver | |
sudo kextload -b com.apple.iokit.IOUSBMassStorageDriver | |
sudo kextload -b com.apple.driver.AppleUSBStorageCoexistentDriver | |
sudo kextload -b com.apple.driver.AppleUSBCardReader | |
sleep 5 | |
check | |
i=$[$i+1] | |
done | |
osascript -e 'display notification "Re-mounting SD Card failed 10 times" with title "Wakeup script"' | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment