Skip to content

Instantly share code, notes, and snippets.

@ccharlton
Last active February 14, 2025 20:19
Show Gist options
  • Save ccharlton/e84c82f60a568163a4b5cb30f6cd514e to your computer and use it in GitHub Desktop.
Save ccharlton/e84c82f60a568163a4b5cb30f6cd514e to your computer and use it in GitHub Desktop.
Maintenance shell script for local workstation updates
#!/bin/zsh
# Workstation maintenance script
# This script is a simple shell script that updates the shell and various libraries.
# It’s a good idea to run this script every week or so to keep a workstation up to date.
# The script can be saved in the `~/bin` directory as executable.
# $ chmod +x ~/bin/maintenance.sh
# To run the script, use the following command:
# $ ~/bin/maintenance.sh
# Crontab example to run the script every Friday 7am
# 0 7 * * 5 ~/bin/maintenance.sh
# Start
echo "Maintenance script starting"
# Shell
echo "\n\n"
echo "1️⃣ Updating shell..."
# $ZSH needs to be defined within the automated script you created
time zsh -ic "$ZSH/tools/upgrade.sh"
# Libraries
echo "\n\n"
echo "2️⃣ Updating Homebrew and recipes..."
time brew update --quiet && brew upgrade --quiet && brew cleanup --quiet
# Google Cloud Platform
echo "\n\n"
echo "3️⃣ Updating GCP components..."
time gcloud components update --quiet
# Docker Desktop
echo "\n\n"
echo "4️⃣ Updating Docker Desktop..."
time docker desktop update
# Lando
echo "\n\n"
echo "5️⃣ Updating Lando..."
time lando update --yes
# Done
echo "\n\n"
echo "✅ Maintenance complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment