#!/bin/bash # Quick start script for LWVWV automation # Usage: ./start-automation.sh [command] # # Commands: # start - Start the automation container # stop - Stop the automation container # restart - Restart the automation container # logs - View container logs # run-now - Trigger subscription immediately # status - Check container status set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" show_help() { cat << EOF LWVWV Automation Quick Start Usage: $0 [command] Commands: start Start the automation container stop Stop the automation container restart Restart the automation container logs View container logs run-now Trigger subscription immediately status Check container status build Rebuild the container image help Show this help message Examples: $0 start # Start automation $0 run-now # Run subscription now $0 logs # View logs $0 logs -f # Follow logs EOF } case "${1:-help}" in start) echo "Starting LWVWV automation container..." docker-compose up -d echo "Container started. Use '$0 logs' to view logs." ;; stop) echo "Stopping LWVWV automation container..." docker-compose down echo "Container stopped." ;; restart) echo "Restarting LWVWV automation container..." docker-compose restart echo "Container restarted." ;; logs) echo "Viewing container logs..." shift # Remove 'logs' from args docker-compose logs "$@" ;; run-now) echo "Triggering subscription immediately..." docker exec lwvwv-subscriber /app/run-subscription.sh ;; status) echo "Container status:" docker-compose ps ;; build) echo "Rebuilding container image..." docker-compose build --no-cache echo "Build complete. Use '$0 start' to start." ;; help|--help|-h) show_help ;; *) echo "Unknown command: $1" show_help exit 1 ;; esac