MinecraftServerControl / mscs

Powerful command-line control for UNIX and Linux powered Minecraft servers
https://minecraftservercontrol.github.io
BSD 2-Clause "Simplified" License
485 stars 62 forks source link

[: =: unexpected operator when running a world imported from previous install #286

Closed Laikar closed 3 years ago

Laikar commented 3 years ago

I keep the config of the minecraft servers i run with mscs on a git repository, when installing mscs on a new machine and set up the configs, i get the following error when i try to run any of the servers i backed up, but if i create a new world the error doesn't happen

/usr/local/bin/msctl: 361: [: =: unexpected operator
/usr/local/bin/msctl: 365: [: =: unexpected operator
/usr/local/bin/msctl: 369: return: Illegal number: -1
sandain commented 3 years ago

Hi @Laikar.

Please post a copy of the mscs.properties file for one of the worlds that is failing. Also, please post a copy of your mscs.defaults file. The error messages appear to be happening in the code that checks true/false values, so I'm guessing that something is wrong here.

Laikar commented 3 years ago

These are the mscs.defaults and the msscs.properties of the waterfall proxy, with txt extension cause github doesn't allow to upload otherwise.

mscs.defaults.txt mscs.properties.txt

sandain commented 3 years ago

I just submitted commit a953325c794a4fee59e4647830dada1d1a20c162, but that won't fix your problem. I just noted that the numerical true/false tests were done incorrectly.

I don't see any issues in your mscs.defaults or mscs.properties files. How about your eula.txt file? If it has something like eula= rather than eula=true, that might be the cause. Could you post a copy?

sandain commented 3 years ago

I just submitted a new commit, 8b6854495646244b51487cc517583b62aa770135, that will provide better error information that might help us debug this issue.

Laikar commented 3 years ago

The proxy world runs waterfall wich doesn't require you to accept eula, and because of that there is no eula file on that world. That seems to be the cause, because when trying to run the proxy world with the new commits i get the following error

Error, the EULA has not been accepted for world proxy.
To accept the EULA, modify /opt/mscs/worlds/proxy/eula.txt file.

but the eula file doesn't exist

sandain commented 3 years ago

Hi @Laikar.

I changed that EULA check to produce a warning rather than an error message with commit https://github.com/MinecraftServerControl/mscs/commit/0064869dae4b8db2fc431e3ff6b2c2f35b9fc047. To get rid of the warning message, simply add eula=true to a new /opt/mscs/worlds/proxy/eula.txt file.

I'm not sure how to handle this better. I would like the message to show up for normal worlds that do not have the EULA accepted to reduce confusion on why a world is not starting properly.

Hopefully this is related to the issue you were having. If not, let me know what the next error is.

Laikar commented 3 years ago

I thiught that was it, but doesn't seem so, when running the proxy this is the whole comand output

The cached copy of the version manifest is up to date.
Use the force-update option to ensure a new copy is downloaded.
Starting Minecraft Server: proxyError verifying the sha1 for the Minecraft server software.

Warning, the EULA has not been accepted for world proxy.
To accept the EULA, modify /opt/mscs/worlds/proxy/eula.txt file.
Erase is control-H (^H).
Invalid true/false value: ""
.

and when i run mscs status with only that world running this is the output

Minecraft Server Status:
  direwolf16: not running.
  lobby: not running.
  proxy: /usr/local/bin/msctl: 2042: printf: Invalid: expected numeric value
/usr/local/bin/msctl: 2042: printf: true/false: expected numeric value
/usr/local/bin/msctl: 2042: printf: Invalid: expected numeric value
/usr/local/bin/msctl: 2042: printf: value:: expected numeric value
running version Invalid true/false value: "" (0 of 0 users online).
running version value: (34 of 0 users online).
running version true/false (0 of 34 users online).
    Port: 25565.
/usr/local/bin/msctl: 2044: [: Invalid: unexpected operator
    Memory used: 0.52GB (0GB allocated).
    Process ID: 3287.
  surv: not running.
  rlcraft: disabled.
sandain commented 3 years ago

I made a mistake on the patch that introduced the error message for invalid true/false values. Commit 3b5c0e1d89226fb0bc3b7f7be80f8ec8e8e3227d fixes this issue. The error message needed to be piped to STDERR, not STDOUT! oops. This is not going to fix the issue, but will clean up those error messages.

Laikar commented 3 years ago

I discovered that the error happens when there is no server.properties file, i copied every setting from the proxy world to a new world and everything worked just fine, but when i delete the server.properties file the error begins to happen.

sandain commented 3 years ago

Ok. This makes sense. How did you restore from backup? Did you use the mscs restore-backup feature as documented here?

Laikar commented 3 years ago

No, i keep all the configurations for the worlds without the actual minecraft worlds on a git repo and i just clone that

sandain commented 3 years ago

I suspect that there is an issue with your directory structure on restored worlds. It appears that you are using the default folder configuration from your linked mscs.defaults.txt, so you should have your server.properties files at:

/opt/mscs/worlds/direwolf16/server.properties
/opt/mscs/worlds/lobby/server.properties
/opt/mscs/worlds/proxy/server.properties
/opt/mscs/worlds/surv/server.properties
/opt/mscs/worlds/rlcraft/server.properties

You can check by executing the following command:

ls -la /opt/mscs/worlds/*/server.properties
Laikar commented 3 years ago

Waterfall is a fork of BungeeCord and as such doesn't use the server.properties file, that is why i deleted it, i can just keep it to prevent the script from doing weird things, but it isn't needed for the proxy to actually operate

sandain commented 3 years ago

I don't have BungeeCord setup on my test server right now, but when I did, it doesn't look like I had the server.properties file there either. I'll try restoring that server from my backup and see if the script reports funky errors.

sandain commented 3 years ago

I am getting some funky errors. I will work through them.

Minecraft Server Status:
  alpha: running version 1.16.5 (0 of 20 users online).
    Port: 25565.
    Memory used: 1.35GB (2GB allocated).
    Process ID: 30436.
  lobby: Invalid true/false value: ""
Invalid true/false value: ""
Invalid true/false value: ""
running.
    Memory used: 0.1GB (2GB allocated).
    Process ID: 32257.
  paper: running version 1.16.5 (0 of 20 users online).
    Port: 25566.
    Memory used: 0.79GB (2GB allocated).
    Process ID: 32630.
sandain commented 3 years ago

I should note that my BungeeCord server appears to be running, the error only seems to exist in the status command. I'm still at work so I can't test if it is truly working yet..

sandain commented 3 years ago

I just submitted commit f397a469388c3086f3db5dc5d3deb41aac39b430. This makes the mscs status command work properly on my Bungeecord server. I still can't test if it is working properly though, but it looks like it is...

Laikar commented 3 years ago

All the errors seem to be fixed now, many thanks for your work, you are awesome

sandain commented 3 years ago

I'm going to close this issue since it appears to be fixed. Please reopen if needed.