Skip to content

Instantly share code, notes, and snippets.

@stickystyle
Last active March 19, 2018 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stickystyle/a488b72d1f773bb8c0df14e3036f2621 to your computer and use it in GitHub Desktop.
Save stickystyle/a488b72d1f773bb8c0df14e3036f2621 to your computer and use it in GitHub Desktop.
Auto-backup installed packages
#!/bin/bash
UPDATED="#Updated: $(date)"
PATH=/usr/local/bin:/usr/local/sbin:$PATH
echo $UPDATED > ~/Dropbox/home/python/requirements.txt
pip3 freeze >> ~/Dropbox/home/python/requirements.txt
echo $UPDATED > ~/Dropbox/home/homebrew/leaves.txt
brew leaves >> ~/Dropbox/home/homebrew/leaves.txt
echo $UPDATED > ~/Dropbox/home/homebrew/casks.txt
brew cask list >> ~/Dropbox/home/homebrew/casks.txt
<?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>net.stickystyle.launched.save_packages</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>/Users/rparrish/Dropbox/home/backup_packages.sh</string>
</array>
<key>StandardErrorPath</key>
<string>/tmp/net.stickystyle.launched.save_packages.err</string>
<key>StandardOutPath</key>
<string>/tmp/net.stickystyle.launched.save_packages.out</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>12</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<key>WatchPaths</key>
<array>
<string>/usr/local/lib/python3.6/site-packages</string>
<string>/usr/local/Cellar</string>
<string>/opt/homebrew-cask/Caskroom</string>
</array>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment