Skip to content

Instantly share code, notes, and snippets.

@ys-qb
Last active November 27, 2016 05:06
Show Gist options
  • Save ys-qb/994aa1b97ce3766712ec53df37fb2420 to your computer and use it in GitHub Desktop.
Save ys-qb/994aa1b97ce3766712ec53df37fb2420 to your computer and use it in GitHub Desktop.
jetdrive
#!/bin/sh
if pgrep Dropbox > /dev/null; then
osascript -e 'tell application "Dropbox" to quit'
fi
diskutil unmountDisk /dev/disk2 > /dev/null 2>&1
#!/bin/sh
diskutil mount /dev/disk2s1 > /dev/null 2>&1
if ! pgrep Dropbox > /dev/null; then
osascript -e 'tell application "Dropbox" to launch'
fi
brew update && brew install sleepwatcher
#startup daemon
sudo ln -sfv /usr/local/opt/sleepwatcher/*.plist /Library/LaunchDaemons/
launchctl load /Library/LaunchDaemons/de.bernhard-baehr.sleepwatcher-20compatibility-localuser.plist
#change scripts executable
chmod a+x ~/.sleep ~/.wakeup
#backup
MOUNT_DIR=/Volumes/sd64
rsync -av --delete ~/Dropbox $MOUNT_DIR/
mv ~/Dropbox ~/Dropbox.org
ln -s $MOUNT_DIR/Dropbox ~/Dropbox
#make sure it's running
#ps -ef | grep sleepwatcher
# 501 20898 1 0 11:35AM ?? 0:01.16 /usr/local/sbin/sleepwatcher -V -s ~/.sleep -w ~/.wakeup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment