#!/bin/bash                                                                        

id=${1:-1801sk13}
name=${2:-KS-2}

found=false
					   
while ! $found
do
	sleep 10
	curl "https://www.ovh.com/engine/api/dedicated/server/availabilities?country=fr&hardware=${id}" 2>/dev/null | jq | grep -v '"availability": "unavailable"' | grep '"availability"' && found=true
done                                                                               
                                                                                   
notify-send -u critical "Kimsufi" "${name} disponible !"
