new script
This commit is contained in:
parent
1268e3ea24
commit
40d1d025a6
1 changed files with 14 additions and 3 deletions
|
@ -11,9 +11,20 @@ data:
|
|||
|
||||
start.sh: |
|
||||
#!/bin/sh
|
||||
|
||||
echo "Starting mini HTTP server on port 8080..."
|
||||
|
||||
while true; do
|
||||
# Wait for HTTP POST and respond
|
||||
{ echo -ne "HTTP/1.1 200 OK\r\nContent-Length: 26\r\n\r\nSIGHUP sent to OpenBAO"; \
|
||||
/tmp/sidecar.sh; } | nc -l -p 8080 -q 1
|
||||
echo "Waiting for HTTP POST..."
|
||||
REQUEST=$(nc -l -p 8080)
|
||||
|
||||
echo "$REQUEST" | grep -q "POST /" && {
|
||||
echo "Received POST request, sending SIGHUP..."
|
||||
/tmp/sidecar.sh
|
||||
RESPONSE="HTTP/1.1 200 OK\r\nContent-Length: 26\r\n\r\nSIGHUP sent to OpenBAO"
|
||||
} || {
|
||||
RESPONSE="HTTP/1.1 405 Method Not Allowed\r\nContent-Length: 18\r\n\r\nMethod Not Allowed"
|
||||
}
|
||||
|
||||
echo -e "$RESPONSE" | nc -N localhost 8081
|
||||
done
|
Reference in a new issue