95 lines
2.1 KiB
Bash
Executable File
95 lines
2.1 KiB
Bash
Executable File
#!/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
|
|
|
|
DOCKER_COMPOSE="docker compose"
|
|
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_COMPOSE 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
|