Created
July 2, 2026 10:01
-
-
Save Neko-Design/c3411a0dc7e6431c10aee309f0fd4a6f to your computer and use it in GitHub Desktop.
Homebrew auto-update profile script
This file contains hidden or 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/bash | |
| # Check for the existance of ~/.brewlastupgraded containing a unix timestamp of the last upgrade | |
| if [ -f ~/.brewlastupgraded ]; then | |
| lastupgraded=$(cat ~/.brewlastupgraded) | |
| else | |
| lastupgraded=0 | |
| fi | |
| # Check if the last upgrade was more than 7 days ago | |
| if [ $(date +%s) -gt $((lastupgraded + 7*24*60*60)) ]; then | |
| echo "It's been more than 7 days since the last brew upgrade. Upgrading now..." | |
| brew update && brew upgrade | |
| # Update the last upgraded timestamp | |
| date +%s > ~/.brewlastupgraded | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment