docker-images/images/kiwix/run.sh

28 lines
684 B
Bash
Raw Normal View History

2022-11-05 22:10:19 +00:00
#!/usr/bin/env bash
2022-11-05 23:50:33 +00:00
mode="$1";
shift;
2022-11-05 22:10:19 +00:00
2022-11-05 23:50:33 +00:00
echo ">>> Environment:";
2022-11-06 03:30:23 +00:00
echo "[wrapper] NOMAD_PORT_kiwix=$NOMAD_PORT_kiwix";
2022-11-05 23:50:33 +00:00
echo "[wrapper] Mode: ${mode}";
echo "[wrapper] Args: $*";
echo ">>> Checking environment";
2022-11-06 03:30:23 +00:00
if [[ -z "${NOMAD_PORT_kiwix}" ]]; then
echo "Error: The environment variable NOMAD_PORT_kiwix is not set. It must be set to the port number to listen on." >&2;
2022-11-05 23:57:16 +00:00
exit 1;
2022-11-05 22:10:19 +00:00
fi
echo ">>> Starting kiwix";
2022-11-05 23:50:33 +00:00
case "${mode}" in
serve )
2022-11-06 03:30:23 +00:00
echo ">>> kiwix-serve --library --port ${NOMAD_PORT_kiwix} /srv/data";
/app/kiwix-serve --library --monitorLibrary --port "${NOMAD_PORT_kiwix}" /srv/dat/library.xml;
2022-11-05 23:50:33 +00:00
;;
* )
echo ">>> kiwix-serve $*";
/app/kiwix-serve "$@";
;;
esac