#!/bin/sh

# Generate random x and y coordinates between 0 and 499 (inclusive)
X=$(shuf -i 0-499 -n 1)
Y=$(shuf -i 0-499 -n 1)

# Generate a random hex color
COLOR=$(openssl rand -hex 3)

# Make the PUT request to the endpoint
curl -X PUT "http://nginx/api?x=$X&y=$Y" -H "Content-Type: application/json" -d "{\"color\":\"#$COLOR\"}"

echo "Task executed at $(date) with x=$X, y=$Y, color=#$COLOR"
