Skip to content
Connor Denihan edited this page Dec 23, 2024 · 3 revisions

Getting Started

This guide explains how to use the Drone Data Management Application script to execute commands across multiple drones in a network. The script supports primary and secondary drone groups with different users.

Note: The script is designed for drone fleet management with SSH access. Ensure your system meets the prerequisites before running the script.

Before you start

Make sure that:

  • You have Bash installed (default on most Unix-like systems)
  • SSH access is configured for target drones
  • The script file (main.bash) has execute permissions (chmod +x main.bash)

Usage Guide

  1. Prepare the script
    Ensure the script is executable:

    chmod +x main.bash
  2. Run the script with arguments
    Supported arguments:

    • -primary, -ip: List of IP addresses for primary group
    • -puser, -user: Username for primary group
    • -secondary: List of IP addresses for secondary group
    • -suser: Username for secondary group
    • -cmd: Command to execute on all drones (use \$DRONE_NUM for drone number)

    Example:

    ./main.bash -primary 1 2 3 -user pilot -cmd "echo Drone \$DRONE_NUM ready"
  3. Using Primary and Secondary Groups
    You can execute commands on two different groups with different users:

    ./main.bash -primary 1 2 -user pilot1 -secondary 3 4 -suser pilot2 -cmd "status"
  4. Allowed IP Ranges
    The script currently allows these IP suffixes:

    • Numbers 1-10
    • Number 15
    • Number 17
    • Numbers 20-25

    To modify allowed ranges, update the allowed_ips array in the script:

    allowed_ips=({1..10} 15 17 {20..25})

Error Handling

The script provides detailed error messages for:

  • Invalid IP addresses
  • IPs outside allowed ranges
  • Duplicate IP addresses
  • Missing required arguments
  • Invalid command format

Tip: The script performs thorough validation before executing any SSH commands to prevent errors during execution.

Clone this wiki locally