#!/bin/bash
set -e
if [ "${1:0:1}" = '-' ]; then
set -- mongod "$@"
fi
if [ "$1" = 'mongod' ]; then
chown -R mongodb /data/db
numa='numactl --interleave=all'
if $numa true &> /dev/null; then
set -- $numa "$@"
fi
exec gosu mongodb "$@"
fi
exec "$@"
IyEvYmluL2Jhc2gKc2V0IC1lCgppZiBbICIkezE6MDoxfSIgPSAnLScgXTsgdGhlbgogICAgICAgIHNldCAtLSBtb25nb2QgIiRAIgpmaQoKaWYgWyAiJDEiID0gJ21vbmdvZCcgXTsgdGhlbgogICAgICAgIGNob3duIC1SIG1vbmdvZGIgL2RhdGEvZGIKCiAgICAgICAgbnVtYT0nbnVtYWN0bCAtLWludGVybGVhdmU9YWxsJwogICAgICAgIGlmICRudW1hIHRydWUgJj4gL2Rldi9udWxsOyB0aGVuCiAgICAgICAgICAgICAgICBzZXQgLS0gJG51bWEgIiRAIgogICAgICAgIGZpCgogICAgICAgIGV4ZWMgZ29zdSBtb25nb2RiICIkQCIKZmkKCmV4ZWMgIiRAIgo=