„scripts/start-server.sh“ ändern

This commit is contained in:
2020-04-02 19:12:33 +02:00
parent 27dff3c760
commit af3dbf250b

View File

@@ -41,88 +41,138 @@ echo "---Starting MariaDB...---"
screen -S MariaDB -L -Logfile ${SERVER_DIR}/MariaDBLog.0 -d -m mysqld_safe screen -S MariaDB -L -Logfile ${SERVER_DIR}/MariaDBLog.0 -d -m mysqld_safe
sleep 10 sleep 10
#echo "---Checking for ExileMod---" echo "---Checking for ExileMod Server---"
#if [ ! -d ${SERVER_DIR}/data ]; then if [ ! -d ${SERVER_DIR}/@ExileServer ]; then
# echo "---ExileMod not found, creating 'data' directory---" if [ ! -d ${SERVER_DIR}/data ]; then
# cd ${SERVER_DIR} echo "---ExileMod Server not found, creating 'data' directory---"
# mkdir ${SERVER_DIR}/data cd ${SERVER_DIR}
# cd ${SERVER_DIR}/data mkdir ${SERVER_DIR}/data
# echo "---Downloading ExileMod Server---" cd ${SERVER_DIR}/data
# if wget -q -nc --show-progress --progress=bar:force:noscroll ${EXILEMOD_SERVER_URL} ; then echo "---Downloading ExileMod Server---"
# echo "---Sucessfully downloaded ExileMod Server---" if wget -q -nc --show-progress --progress=bar:force:noscroll ${EXILEMOD_SERVER_URL} ; then
# else echo "---Sucessfully downloaded ExileMod Server---"
# echo "---Can't download ExileMod Server, putting server into sleep mode---" else
# sleep infinity echo "---Can't download ExileMod Server, putting server into sleep mode---"
# fi sleep infinity
# unzip ${EXILEMOD_SERVER_URL##*/} fi
# cp -R ${SERVER_DIR}/data/Arma\ 3\ Server/* ${SERVER_DIR} unzip ${EXILEMOD_SERVER_URL##*/}
# rm -R ${SERVER_DIR}/data/Arma\ 3\ Server/ cp -R ${SERVER_DIR}/data/Arma\ 3\ Server/* ${SERVER_DIR}
# rm ${SERVER_DIR}/data/${EXILEMOD_SERVER_URL##*/} rm -R ${SERVER_DIR}/data/Arma\ 3\ Server/
# touch ${SERVER_DIR}/data/"${EXILEMOD_SERVER_URL##*/}_installed" rm ${SERVER_DIR}/data/${EXILEMOD_SERVER_URL##*/}
# if [ ! -d ${SERVER_DIR}/@ExileServer ]; then touch ${SERVER_DIR}/data/"${EXILEMOD_SERVER_URL##*/}_installed"
# echo "---Something went wrong, ExileModServer not correctly installed---" if [ ! -d ${SERVER_DIR}/@ExileServer ]; then
# sleep infinity echo "---Something went wrong, ExileMod Server not correctly installed---"
# fi sleep infinity
# echo "---ExileMod Server successfully installed---" fi
# echo "---Downloading ExileMod (this can take some time)---" echo "---ExileMod Server successfully installed---"
# cd ${SERVER_DIR}/data fi
# if wget -q -nc --show-progress --progress=bar:force:noscroll ${EXILEMOD_URL} ; then else
# echo "---Sucessfully downloaded ExileMod---" echo "---ExileMod Server found!---"
# else fi
# echo "---Can't download ExileMod, putting server into sleep mode---"
# sleep infinity
# fi
# unzip ${EXILEMOD_URL##*/}
# mv ${SERVER_DIR}/data/@Exile ${SERVER_DIR}
# rm ${SERVER_DIR}/data/${EXILEMOD_URL##*/}
# touch ${SERVER_DIR}/data/"${EXILEMOD_URL##*/}_installed"
# if [ ! -d ${SERVER_DIR}/@Exile ]; then
# echo "---Something went wrong, ExileMod not correctly installed---"
# sleep infinity
# fi
# echo "---ExileMod successfully installed---"
#fi
#echo "---Checking if 'exile' database is connected correctly---" echo "---Checking for ExileMod Files---"
#INJECTED="$(mysql -u "steam" -p"exile" -e "USE 'exile'; SHOW TABLES;" | grep 'account')" if [ "${WORKSHOP_MAN_INST}" == "true" ]; then
#if [ "$INJECTED" = "" ] ; then if [ ! -d ${SERVER_DIR}/steamapps/workshop/content/107410/1487484880 ]; then
# echo "---Database not connected, connecting...---" echo "------------------------------------------------------------------------------"
# mysql -u "steam" -p"exile" -e "SOURCE $SERVER_DIR/data/MySQL/exile.sql" echo "---Workshop installation set to manual please install the modfiles manually---"
# INJECTED="$(mysql -u "steam" -p"exile" -e "USE 'exile'; SHOW TABLES;" | grep 'account')" echo "--------with this command when you opened a console for the container:--------"
# if [ "$INJECTED" = "account" ] ; then echo "${STEAMCMD_DIR}/steamcmd.sh +login [USERNAME] +force_install_dir ${SERVER_DIR} +workshop_download_item 107410 1487484880 +quit"
# echo "---Database successfully connected!---" echo
# else echo "-----or with this command when you are running the console from the host:-----"
# echo "---Something went wrong, could not connect database!---" echo "docker exec -u steam -ti [NAMEOFYOURCONTAINER] ${STEAMCMD_DIR}/steamcmd.sh +login [USERNAME] +force_install_dir ${SERVER_DIR} +workshop_download_item 107410 1487484880 +quit"
# sleep infinity echo
# fi echo "-----------Please replace [USERNAME] with your Steam username and-------------"
#fi echo "-----[NAMEOFYOURCONTAINER] with the name of your containername if you are-----"
#if [ "$INJECTED" = "account" ] ; then echo "----executing the second command and restart the container if it's finished---"
# echo "---Database setup correct!---" echo "----Also please let the variable for the manual installation set to 'true'----"
#fi echo "------------------------------------------------------------------------------"
sleep infinity
else
if [ ! -d ${SERVER_DIR}/@Exile ]; then
mkdir ${SERVER_DIR}/@Exile
mv ${SERVER_DIR}/steamapps/workshop/content/107410/1487484880/* ${SERVER_DIR}/@Exile
INSTALLED_M_V="$(ls -la -d ${SERVER_DIR}/@Exile/* 2>/dev/null | head -1 | cut -d "/" -f 5)"
if [ -z "$INSTALLED_M_V" ]; then
echo "---Something went wrong, ExileMod not correctly installed---"
sleep infinity
fi
echo "---ExileMod successfully installed---"
else
echo "---ExileMod Files found!---"
fi
fi
else
if [ ! -d ${SERVER_DIR}/@Exile ]; then
echo "---ExlieMod Files not found, installing---"
mkdir ${SERVER_DIR}/@Exile
if [ ! -d ${SERVER_DIR}/steamapps/workshop/content/107410/1487484880 ]; then
echo "---ExileMod not found, downloading from Stem Workshop---"
${STEAMCMD_DIR}/steamcmd.sh \
+login ${USERNAME} ${PASSWRD} \
+force_install_dir ${SERVER_DIR} \
+workshop_download_item 107410 1487484880 \
+quit
if [ ! -d ${SERVER_DIR}/steamapps/workshop/content/107410/1487484880 ]; then
echo "----------------------------------------------------"
echo "---Can't download ExileMod, please make sure that---"
echo "-----the account that you specified has a valid-----"
echo "--------license/purchase for the game ArmA3---------"
echo "---itself otherwise the download will always fail!--"
echo "----------------------------------------------------"
echo "-----------Putting server into sleep mode-----------"
echo "----------------------------------------------------"
sleep infinity
fi
mv ${SERVER_DIR}/steamapps/workshop/content/107410/1487484880/* ${SERVER_DIR}/@Exile
INSTALLED_M_V="$(ls -la -d ${SERVER_DIR}/@Exile/* 2>/dev/null | head -1 | cut -d "/" -f 5)"
if [ -z "$INSTALLED_M_V" ]; then
echo "---Something went wrong, ExileMod not correctly installed---"
sleep infinity
fi
echo "---ExileMod successfully installed---"
fi
else
echo "---ExileMod Files found!---"
fi
fi
#echo "---Checking if ExileMod is configured correctly for database connection---" echo "---Checking if 'exile' database is connected correctly---"
#if grep -rq 'Username = changeme' ${SERVER_DIR}/@ExileServer/extdb-conf.ini; then INJECTED="$(mysql -u "steam" -p"exile" -e "USE 'exile'; SHOW TABLES;" | grep 'account')"
# sed -i '/Username = changeme/c\Username = steam' ${SERVER_DIR}/@ExileServer/extdb-conf.ini if [ "$INJECTED" = "" ] ; then
# sed -i '/Username = steam/!b;n;cPassword = exile' ${SERVER_DIR}/@ExileServer/extdb-conf.ini echo "---Database not connected, connecting...---"
# echo "---Corrected ExileMod database connection---" mysql -u "steam" -p"exile" -e "SOURCE $SERVER_DIR/data/MySQL/exile.sql"
#fi INJECTED="$(mysql -u "steam" -p"exile" -e "USE 'exile'; SHOW TABLES;" | grep 'account')"
if [ "$INJECTED" = "account" ] ; then
echo "---Database successfully connected!---"
else
echo "---Something went wrong, could not connect database!---"
sleep infinity
fi
fi
if [ "$INJECTED" = "account" ] ; then
echo "---Database setup correct!---"
fi
#if grep -rq 'Username = steam' ${SERVER_DIR}/@ExileServer/extdb-conf.ini; then echo "---Checking if ExileMod is configured correctly for database connection---"
# if grep -rq 'Password = exile' ${SERVER_DIR}/@ExileServer/extdb-conf.ini; then if grep -rq 'Username = changeme' ${SERVER_DIR}/@ExileServer/extdb-conf.ini; then
# : sed -i '/Username = changeme/c\Username = steam' ${SERVER_DIR}/@ExileServer/extdb-conf.ini
# else sed -i '/Username = steam/!b;n;cPassword = exile' ${SERVER_DIR}/@ExileServer/extdb-conf.ini
# sed -i '/Username = steam/!b;n;cPassword = exile' ${SERVER_DIR}/@ExileServer/extdb-conf.ini echo "---Corrected ExileMod database connection---"
# fi fi
# echo "---ExileMod database connection correct---"
#fi if grep -rq 'Username = steam' ${SERVER_DIR}/@ExileServer/extdb-conf.ini; then
if grep -rq 'Password = exile' ${SERVER_DIR}/@ExileServer/extdb-conf.ini; then
:
else
sed -i '/Username = steam/!b;n;cPassword = exile' ${SERVER_DIR}/@ExileServer/extdb-conf.ini
fi
echo "---ExileMod database connection correct---"
fi
echo "---Prepare Server---" echo "---Prepare Server---"
cp ${DATA_DIR}/steamcmd/linux32/* ${SERVER_DIR} cp ${DATA_DIR}/steamcmd/linux32/* ${SERVER_DIR}
chmod -R ${DATA_PERM} ${DATA_DIR} chmod -R ${DATA_PERM} ${DATA_DIR}
echo "---Putting server to sleep, Container is now under construction---"
sleep infinity
echo "---Start Server---" echo "---Start Server---"
cd ${SERVER_DIR} cd ${SERVER_DIR}
screen -S ArmA3 -L -Logfile ${SERVER_DIR}/Arma3Log.0 -d -m ./arma3server -cfg=@ExileServer/basic.cfg -config=@ExileServer/config.cfg -autoinit -mod=@Exile\; -servermod=@ExileServer\; >> ExileModLog.0 ${GAME_PARAMS} screen -S ArmA3 -L -Logfile ${SERVER_DIR}/Arma3Log.0 -d -m ./arma3server -cfg=@ExileServer/basic.cfg -config=@ExileServer/config.cfg -autoinit -mod=@Exile\; -servermod=@ExileServer\; >> ExileModLog.0 ${GAME_PARAMS}