Rewrite start-script

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-01-07 01:46:21 +01:00
parent d7ccef20d6
commit 5bd264cbd0
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -1,38 +1,39 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
VOLUME=/teamspeak3 VOLUME=/teamspeak3
echo " ----- docker-ts3 ------" echo "- Linking host mounted database..."
echo "1. Linking host mounted database"
ln -s $VOLUME/ts3server.sqlitedb /opt/teamspeak3-server_linux_amd64/ts3server.sqlitedb ln -s $VOLUME/ts3server.sqlitedb /opt/teamspeak3-server_linux_amd64/ts3server.sqlitedb
echo "2. Link the files-folder into the host-mounted volume." echo "- Link the files-folder into the host-mounted volume..."
mkdir -p /teamspeak3/files
mkdir -p ${VOLUME}/files
if ! [ -L /opt/teamspeak3-server_linux_amd64/files ]; then if ! [ -L /opt/teamspeak3-server_linux_amd64/files ]; then
rm -rf /opt/teamspeak3-server_linux_amd64/files rm -rf /opt/teamspeak3-server_linux_amd64/files
ln -s /teamspeak3/files /opt/teamspeak3-server_linux_amd64/files ln -s ${VOLUME}/files /opt/teamspeak3-server_linux_amd64/files
fi fi
echo "3. Starting TS3-Server." echo "- Starting TS3-Server..."
echo "Check if ts3server.ini exists in host-mounted volume." if [ -f "${VOLUME}/ts3server.ini" ]; then
if [ -f $VOLUME/ts3server.ini ]; then echo " '${VOLUME}/ts3server.ini' found. Using as config file."
echo "$VOLUME/ts3server.ini found. Using ini as config file." echo " HINT: If this ini was transfered from another ts3-install you may want"
echo "HINT: If this ini was transfered from another ts3-install you may want to make sure the following settings are active for the usage of host-mounted volume: (OPTIONAL)" echo " to make sure the following settings are active for the usage of host-mounted volume:"
echo "query_ip_whitelist='/teamspeak3/query_ip_whitelist.txt'" echo " - query_ip_whitelist='${VOLUME}/query_ip_whitelist.txt'"
echo "query_ip_backlist='/teamspeak3/query_ip_blacklist.txt'" echo " - query_ip_backlist='${VOLUME}/query_ip_blacklist.txt'"
echo "logpath='/teamspeak3/logs/'" echo " - logpath='${VOLUME}/logs/'"
echo "licensepath='/teamspeak3/'" echo " - licensepath='${VOLUME}/'"
echo "inifile='/teamspeak3/ts3server.ini'" echo " - inifile='${VOLUME}/ts3server.ini'"
/opt/teamspeak3-server_linux_amd64/ts3server_minimal_runscript.sh \ /opt/teamspeak3-server_linux_amd64/ts3server_minimal_runscript.sh \
inifile="/teamspeak3/ts3server.ini" inifile="${VOLUME}/ts3server.ini"
else else
echo "$VOLUME/ts3server.ini not found. Creating new config file." echo " '${VOLUME}/ts3server.ini' not found. Creating new config file."
/opt/teamspeak3-server_linux_amd64/ts3server_minimal_runscript.sh \ /opt/teamspeak3-server_linux_amd64/ts3server_minimal_runscript.sh \
query_ip_whitelist="/teamspeak3/query_ip_whitelist.txt" \ createinifile=1 \
query_ip_backlist="/teamspeak3/query_ip_blacklist.txt" \ inifile="${VOLUME}/ts3server.ini" \
logpath="/teamspeak3/logs/" \ licensepath="${VOLUME}/" \
licensepath="/teamspeak3/" \ logpath="${VOLUME}/logs/" \
inifile="/teamspeak3/ts3server.ini" \ query_ip_backlist="${VOLUME}/query_ip_blacklist.txt" \
createinifile=1 query_ip_whitelist="${VOLUME}/query_ip_whitelist.txt"
fi fi