#!/bin/bash
host=10.200.27.5
username="Administrator"
password="univention"
COOKIEJAR="$(mktemp)"

# execute the following command on the host before running this script
# echo -en "\tdef query(self, request):\n\t\timport os,subprocess\n\t\tsubprocess.call(['kill', '-9', str(os.getpid())])\n" >> /usr/share/pyshared/univention/management/console/modules/ucr/__init__.py

curl -s --cookie "$COOKIEJAR" --cookie-jar "$COOKIEJAR" -H "Content-Type: application/json" -d '{"options":{"username":"'"$username"'","password":"'"$password"'"}}' "http://$host/umcp/auth"

for ((i=0; i<=1000; i++)); do
	curl -s --cookie "$COOKIEJAR" --cookie-jar "$COOKIEJAR" -H "Content-Type: application/json" -d '{"options":{}}' "http://$host/umcp/command/ucr/query" &
done
