Skip to content

Instantly share code, notes, and snippets.

@kogakure
Created February 3, 2010 20:49
Show Gist options
  • Select an option

  • Save kogakure/294006 to your computer and use it in GitHub Desktop.

Select an option

Save kogakure/294006 to your computer and use it in GitHub Desktop.
Bash: Eject/reconnect external harddrives with SleepWatcher (http://www.bernhard-baehr.de/)
#!/bin/sh
osascript -e 'tell application "Finder" to eject "Backup"'
osascript -e 'tell application "Finder" to eject "Media"'
osascript -e 'tell application "Finder" to eject "Daten"'
osascript -e 'tell application "Finder" to delay 5'
#!/bin/sh
backupVolume=`diskutil list | awk '/ Backup / {print $6}'`
if [ ! -z "$backupVolume" ]
then
diskutil mount $backupVolume
fi
mediaVolume=`diskutil list | awk '/ Media / {print $6}'`
if [ ! -z "$mediaVolume" ]
then
diskutil mount $mediaVolume
fi
dataVolume=`diskutil list | awk '/ Daten / {print $6}'`
if [ ! -z "$dataVolume" ]
then
diskutil mount $dataVolume
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment