Linux server cannot be started if there's a space in the directory path
pingouyn opened this issue · comments
Game Version
v1.19.0.rc6
Platform
Linux
Modded
None
SP/MP
None
Description
I like to manage my game servers by running them within a separate directory each, not all within the default VSPATH='/home/vintagestory/server'. Easier to manage different releases of the game and of test worlds that way.
When the directory path countains spaces the server.sh script does not work at all.
I believe it could be resolved with the following changes (tried the start/stop/status/restart commands with success) . Hope that helps:
Filename: server.sh
Line 31:
Old line:
INVOCATION="dotnet ${SERVICE} --dataPath ${DATAPATH} ${OPTIONS}"
New line:
INVOCATION="dotnet ${SERVICE} --dataPath "${DATAPATH}" ${OPTIONS}"
Line 79:
Old line:
vs_version ${VSPATH} # otherwise abort
New line:
vs_version "${VSPATH}" # otherwise abort
Line 83:
Old line:
cd ${VSPATH}
New line:
cd "${VSPATH}"
Line 85: (don't think the cd is needed a second time)
Old line:
if as_user "cd ${VSPATH} && screen -h ${HISTORY} -dmS ${SCREENNAME} ${INVOCATION}" ; then
New line:
if as_user "screen -h ${HISTORY} -dmS ${SCREENNAME} ${INVOCATION}" ; then
As an added bonus, I like to run the script from a directory other than where the server.sh script is located, and to keep the game data within the same directory as the server it depends on, so I changed:
line 23:
VSPATH=$(dirname -- "$(readlink -f -- "$0")")
line24
DATAPATH="${VSPATH}/VintagestoryData"
Maybe this could be added as a choice to the user?
"Do you want to run this server in your /home folder (type 1) or its local directory (type 2)?"
How to reproduce
No response
Screenshots
No response
Logs
Log
ty will be fixed in the next release