Add a bash+awk variant of a flow request

stil need powershell and python (esxi)

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15903 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2013-04-09 18:16:38 +00:00
parent 29efa2321b
commit 9c368aaf55

View File

@ -0,0 +1,17 @@
#!/bin/bash
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
exec 13<>/dev/udp/$1/$2
echo "resourcerequest: xcatd" >&13
parpid=$$
touch /tmp/goahead.$parpid
touch /tmp/killme.$parpid
exec 2> /dev/null
while ! grep 'resourcerequest: ok' /tmp/goahead.$parpid > /dev/null; do
(
mypid=$BASHPID
(sleep $(((RANDOM%60)+120)).$((RANDOM%50)); if [ -f /tmp/killme.$parpid ]; then kill -TERM $mypid; fi) &
exec awk '{print $0 > "/tmp/goahead.'$parpid'";exit}' <&13
)
done
rm /tmp/killme.$parpid