26 lines
676 B
Bash
Executable File
26 lines
676 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
if [ ! -d "/app/conf" ]; then
|
|
mkdir /app/conf
|
|
fi
|
|
|
|
if [ ! -f "/app/conf/config.json" ]; then
|
|
cp /conf/config.sample.json /app/conf/config.json
|
|
elif [ "/conf/config.sample.json" -nt "/app/conf/config.json" ]; then
|
|
echo "example config file is newer than existing config."
|
|
echo "replacing existing file by new config"
|
|
|
|
CONFIG_BACKUP="/app/conf/config_$(date +"%Y%m%d_%H%M%s").json"
|
|
|
|
echo "saving existing config as ${CONFIG_BACKUP}"
|
|
|
|
cp /app/conf/config.json ${CONFIG_BACKUP}
|
|
cp /conf/config.sample.json /app/conf/config.json
|
|
fi
|
|
|
|
if [ -z "$@" ] ; then
|
|
exec "/app/dns-proxy-server" -XX:MaxHeapSize=50m -XX:MaxNewSize=10m
|
|
else
|
|
exec "$@"
|
|
fi
|