Last active
July 11, 2022 00:32
-
-
Save boogah/cdbbd337b0b447175061 to your computer and use it in GitHub Desktop.
Never think about maintaining your homebrew install again with this shitty (but useful) shell script & cron job!
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/bash | |
echo "" | |
echo "`date`: RUNNING: brew update" | |
/usr/local/bin/brew update | |
echo "`date`: FINISHED: brew update" | |
echo "" | |
echo "`date`: RUNNING: brew upgrade" | |
/usr/local/bin/brew upgrade | |
echo "`date`: FINISHED: brew upgrade" | |
echo "" | |
echo "`date`: RUNNING: brew cleanup" | |
/usr/local/bin/brew cleanup | |
echo "`date`: FINISHED: brew cleanup" | |
echo "" | |
echo "All done! Enjoy a cold one! 🍺 " | |
echo "" |
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
MAILTO="" | |
0 9,21 * * * /Users/USERNAME/scripts/ale.bash >> /Users/USERNAME/logs/ale.log |
Add 2>&1
to the end of that cron so any output on stderr
also hit the log file.
eg:
0 9,21 * * * /Users/USERNAME/scripts/ale.bash >> /Users/USERNAME/logs/ale.log 2>&1
Or just ignore all the output (runs every 6 hours starting at midnight, 6am, etc)
30 */6 * * * /usr/local/bin/brew update > /dev/null 2>&1 && /usr/local/bin/brew upgrade > /dev/null 2>&1 && /usr/local/bin/brew cleanup > /dev/null 2>&1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!