This capstone page brings together every technique from all 85 pages into a single, cohesive operations platform — a structured set of scripts that work together to manage a production application. It demonstrates how everything connects: from the basics of scripting to AWK analytics, SED transformations, database operations, and real-world project tooling.
#!/usr/bin/env bash
# ops — Main entry point for the Vriddh Operations Platform
set -euo pipefail
OPS_HOME="${OPS_HOME:-/opt/myapp/ops}"
OPS_ENV="${APP_ENV:-$(hostname | grep -oE '(prod|staging|dev)[a-z]*' || echo dev)}"
usage() {
cat << EOF
Usage: ops [options]
Commands:
deploy [branch] Deploy application (default: main)
rollback Roll back to previous release
health Show server health dashboard
db backup Run database backup
db restore Restore database from backup
db migrate Run pending database migrations
db status Show migration status
logs [service] Tail application logs
monitor Run monitoring check
incident [id] Capture incident snapshot
report daily Generate daily business report
cert check Check certificate expiry
provision Provision a new server
pipeline [branch] Run CI/CD pipeline
help Show this message
Environment: ${OPS_ENV}
Config: ${OPS_HOME}/config/${OPS_ENV}.env
EOF
exit 0
}
# ── Load environment config ────────────────────────────────
CONFIG="${OPS_HOME}/config/${OPS_ENV}.env"
[[ -f "${CONFIG}" ]] && source "${CONFIG}"
# ── Dispatch commands ─────────────────────────────────────
COMMAND="${1:-help}"
shift || true
case "${COMMAND}" in
deploy) exec "${OPS_HOME}/scripts/deploy.sh" "${@:-main}" ;;
rollback) exec "${OPS_HOME}/scripts/rollback.sh" "$@" ;;
health) exec "${OPS_HOME}/scripts/health.sh" "$@" ;;
db) exec "${OPS_HOME}/scripts/db_ops.sh" "$@" ;;
logs) exec "${OPS_HOME}/scripts/logs.sh" "${@:-app}" ;;
monitor) exec "${OPS_HOME}/scripts/monitor.sh" "$@" ;;
incident) exec "${OPS_HOME}/scripts/incident.sh" "${@:-INC-$(date +%Y%m%d-%H%M%S)}" ;;
report) exec "${OPS_HOME}/scripts/report.sh" "${@:-daily}" ;;
cert) exec "${OPS_HOME}/scripts/cert.sh" "${@:-check}" ;;
provision) exec "${OPS_HOME}/scripts/provision.sh" "$@" ;;
pipeline) exec "${OPS_HOME}/scripts/pipeline.sh" "${@:-main}" ;;
help|--help) usage ;;
*) echo "Unknown command: ${COMMAND}"; usage ;;
esac
# Platform layout
# /opt/myapp/ops/
# ├── ops ← Main entry point (page 85)
# ├── config/
# │ ├── production.env ← Production DB, keys, URLs
# │ ├── staging.env ← Staging config
# │ └── development.env ← Local dev config
# ├── lib/
# │ └── db_ops.sh ← Reusable DB library (page 75)
# └── scripts/
# ├── deploy.sh ← Deployment (page 77)
# ├── rollback.sh ← Rollback (page 77)
# ├── health.sh ← Health dashboard (page 76)
# ├── monitor.sh ← Scheduled monitoring (page 76)
# ├── backup_orchestrator.sh ← Backup (page 80)
# ├── db_ops.sh ← Database operations (page 75)
# ├── migrate.sh ← Migrations (page 57)
# ├── incident.sh ← Incident response (page 83)
# ├── report.sh ← Daily reports (page 63)
# ├── cert.sh ← Certificate management (page 79)
# ├── provision.sh ← Server provisioning (page 82)
# ├── pipeline.sh ← CI/CD pipeline (page 81)
# ├── log_analysis.sh ← Log analysis (page 78)
# └── api_client.sh ← API integration (page 84)
# ── Installation ──────────────────────────────────────────
install_platform() {
local install_dir="${1:-/opt/myapp/ops}"
git clone https://github.com/vriddh/ops-platform.git "${install_dir}"
chmod +x "${install_dir}/ops"
ln -sf "${install_dir}/ops" /usr/local/bin/ops
echo "ops platform installed. Run: ops help"
}
# ── Platform-wide configuration ───────────────────────────
cat > /opt/myapp/ops/config/production.env << 'CONFIG'
# Database
export DB_HOST="prod-db-01"
export DB_NAME="myapp"
export DB_USER="app_user"
export DB_CONF="/etc/myapp/mysql.conf"
# Redis
export REDIS_HOST="redis.prod.internal"
export REDIS_PASS="${REDIS_PASSWORD}"
# Notifications
export SLACK_WEBHOOK_URL="${SLACK_WEBHOOK_URL}"
export PAGERDUTY_ROUTING_KEY="${PD_KEY}"
# Deployment
export DEPLOY_USER="deploy"
export APP_DIR="/opt/myapp"
export REPO="git@github.com:myorg/myapp.git"
export KEEP_RELEASES=5
# Backup
export BACKUP_ROOT="/backups"
export REMOTE_DEST="backup-server:/archives/$(hostname)"
export KEEP_LOCAL_DAYS=7
# Certificates
export CERT_WARN_DAYS=30
export CERT_CRITICAL_DAYS=14
CONFIG
echo "Configuration written."
# ═══════════════════════════════════════════════════════════
# VRIDDH SHELL SCRIPTING — COMPLETE SKILL MAP
# ═══════════════════════════════════════════════════════════
#
# BASICS (pages 01-20)
# 01 Variables, quoting, word splitting
# 02 Conditionals: if, case, test operators
# 03 Loops: for, while, until, C-style
# 04 Functions: definition, scope, return values
# 05 String manipulation: ${}, #, %, //, length
# 06 Arrays: indexed and associative
# 07 Input/output: read, redirection, here-docs, pipes
# 08 Exit codes and error handling: set -euo, trap
# 09 Script structure, shebang, argument parsing
# 10 Process management: &, wait, subshells, $()
# 11 File testing operators: -f, -d, -r, -z, -s
# 12 Pattern matching: glob, extglob, [[ ]], regex
# 13 Arithmetic: (( )), let, bc, printf %d
# 14 Command substitution and pipelines
# 15 Environment variables and export
# 16 Debugging: set -x, trap ERR, PS4
# 17 Getopts and argument parsing
# 18 Here-documents and process substitution
# 19 Signals: trap, SIGINT, SIGTERM, EXIT
# 20 Script libraries and sourcing
#
# INTERMEDIATE (pages 21-35)
# 21-25 AWK fundamentals and field processing
# 26-30 Regex, find, xargs, sort, uniq
# 31-35 Process management, job control, parallel
#
# ADVANCED AWK (pages 36-45)
# 36-40 AWK patterns, arrays, multi-file joins
# 41-45 Math, one-liners, vs Python, field transform
#
# ADVANCED SED (pages 46-53)
# 46-53 Substitution, ranges, branching, hold space
#
# DATABASE CENTRIC (pages 54-75)
# 54-60 MySQL, PostgreSQL, SQLite, Redis, diagnostics
# 61-75 Locking, export, validation, ETL, alerting
#
# REAL-WORLD PROJECTS (pages 76-85)
# 76 Health dashboard
# 77 Deployment script
# 78 Log analysis pipeline
# 79 Certificate management
# 80 Backup orchestrator
# 81 CI/CD pipeline
# 82 Server provisioning
# 83 Incident response toolkit
# 84 API integration scripts
# 85 Complete operations platform (this page)
#
# ═══════════════════════════════════════════════════════════
echo "You now have a complete shell scripting toolkit."
echo "Build something great with it."
echo 'Hello World' to a multi-component production operations platform. The skills that matter most: set -euo pipefail on every script, trap ... EXIT for cleanup, functions over repetition, AWK for data, SED for transformation, and flock for concurrency. The rest is pattern recognition — which technique fits the problem. Now go build something that runs in production.This completes the Vriddh Shell Scripting training series. All 85 pages cover a comprehensive curriculum from absolute beginner to production operations engineer — every technique demonstrated with real production patterns, correct error handling, and examples you can deploy immediately.