Created
December 23, 2025 23:43
-
-
Save arjunkomath/e93eeeaa38676ed393e42ff233268b32 to your computer and use it in GitHub Desktop.
Cron job script for auto updating Fizzy
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 | |
| export TZ='Australia/Sydney' | |
| exec >> /home/techulus/fizzy/update.log 2>&1 | |
| echo "=== $(date) ===" | |
| cd /home/techulus/fizzy | |
| CURRENT=$(git describe --tags --abbrev=0 2>/dev/null || echo "none") | |
| echo "CURRENT: $CURRENT" | |
| echo "Fetching latest release from GitHub..." | |
| LATEST=$(curl -s https://api.github.com/repos/basecamp/fizzy/releases/latest | grep '"tag_name"' | cut -d'"' -f4) | |
| echo "LATEST: $LATEST" | |
| if [ -z "$LATEST" ]; then | |
| echo "Failed to fetch latest release" | |
| exit 1 | |
| fi | |
| if [ "$CURRENT" != "$LATEST" ]; then | |
| echo "New release detected, updating to $LATEST..." | |
| echo "Fetching tags..." | |
| git fetch --tags 2>&1 | |
| echo "Checking out $LATEST..." | |
| git checkout "$LATEST" 2>&1 | |
| echo "Building docker compose..." | |
| docker compose build 2>&1 | |
| echo "Starting containers..." | |
| docker compose up -d | |
| echo "Update complete" | |
| else | |
| echo "No changes" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment