infra-role-mediawiki/templates/healthcheck.sh.j2

11 lines
374 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
# vim: ft=bash
# This script is just a workaround for lack curl or wget.
# https://ceh51.blogspot.com/2016/07/how-to-open-tcpudp-sockets-bash-shell.html
exec 5<>/dev/tcp/localhost/{{ mediawiki_app_cont_port }}
echo -e 'GET /FAQ HTTP/1.1\r
Host: localhost:{{ mediawiki_app_cont_port }}\r
Connection: close\r
\r' >&5
timeout 1 cat <&5 | grep FAQ || exit 1