Why this matters
As DevOps engineers, we often automate deployments — but how do we verify that the new build actually reached the server? Instead of logging in manually every time, we can use a small shell script to automate this check.
🖥️ The Shell Script
!/bin/bash
Variables
APP_URL="http://your-server-ip:8080/health"
EXPECTED_VERSION="1.0.0"
Call the app and check version
DEPLOYED_VERSION=$(curl -s $APP_URL | grep "version" | cut -d '"' -f4)
if [ "$DEPLOYED_VERSION" == "$EXPECTED_VERSION" ]; then
echo "✅ Build $EXPECTED_VERSION is deployed successfully!"
else
echo "❌ Build not deployed. Found version: $DEPLOYED_VERSION"
fi
📌 How it works
1.Define the server endpoint (e.g., /health, /version, or your API’s status endpoint).
2.Use curl to fetch the response.
3.Extract the build/version info.
4.Compare it with the expected version.
🧪 Sample Output
If deployment succeeded:
✅ Build 1.0.0 is deployed successfully!
If deployment failed:
❌ Build not deployed. Found version: 1.2.2
🚀 Takeaway
With just a few lines of Bash, you can automatically check whether your build has been deployed correctly. This script can even be added to your CI/CD pipeline as a post-deploy verification step.
💬 What about you?
👉 How do you verify your deployments today — manual check or automated script?
Top comments (0)