Skip to content

Instantly share code, notes, and snippets.

@arjunkomath
Created December 23, 2025 23:43
Show Gist options
  • Select an option

  • Save arjunkomath/e93eeeaa38676ed393e42ff233268b32 to your computer and use it in GitHub Desktop.

Select an option

Save arjunkomath/e93eeeaa38676ed393e42ff233268b32 to your computer and use it in GitHub Desktop.
Cron job script for auto updating Fizzy
#!/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