Commit ed7bc89e authored by Rohan  Kumar's avatar Rohan Kumar
Browse files

removed update_points

parent e639705a
Loading
Loading
Loading
Loading
+0 −35
Original line number Diff line number Diff line
#!/bin/bash

# Endpoint URL for updating points
URL="http://localhost:8080/pointset/set123"

# Initialize random seed once
RANDOM_SEED=$(date +%s)

# Loop indefinitely to update points
while true; do
    # Generate random points
    x1=$(awk -v min=0 -v max=10 -v seed=$RANDOM_SEED 'BEGIN{srand(seed); print min+rand()*(max-min)}')
    y1=$(awk -v min=0 -v max=10 -v seed=$RANDOM_SEED 'BEGIN{srand(seed + 1); print min+rand()*(max-min)}')
    z1=$(awk -v min=0 -v max=10 -v seed=$RANDOM_SEED 'BEGIN{srand(seed + 2); print min+rand()*(max-min)}')

    x2=$(awk -v min=0 -v max=10 -v seed=$RANDOM_SEED 'BEGIN{srand(seed + 3); print min+rand()*(max-min)}')
    y2=$(awk -v min=0 -v max=10 -v seed=$RANDOM_SEED 'BEGIN{srand(seed + 4); print min+rand()*(max-min)}')
    z2=$(awk -v min=0 -v max=10 -v seed=$RANDOM_SEED 'BEGIN{srand(seed + 5); print min+rand()*(max-min)}')

    # Create JSON payload
    JSON_PAYLOAD="{\"points\":[{\"x\":$x1,\"y\":$y1,\"z\":$z1},{\"x\":$x2,\"y\":$y2,\"z\":$z2}]}"

    # Send POST request to update the point set
    response=$(curl -s -o /dev/null -w "%{http_code}" -X POST -H "Content-Type: application/json" -d "$JSON_PAYLOAD" $URL)

    # Check if the POST was successful
    if [[ "$response" -ne 200 ]] ; then
        echo "Failed to update points, server responded with status: $response"
        break  # or handle error differently
    fi

    # Wait for a bit before the next update
    sleep 5
done