Closed sugoidogo closed 2 years ago
It is not about mcrcon. In bash, MCRCON_PORT
and MCRCON_PASS
in this case hadn't been environment variables until export
was used for them. The behavour in this case is actually what should happen.
The following command can also be used for running mcrcon
with this two environment variables temporarily set:
MCRCON_PORT=25572 MCRCON_PASS=password mcrcon
What about systemd? I have a unit file:
...
EnvironmentFile=/opt/minecraft/.env
...
ExecStop=mcrcon save-all stop
...
/opt/minecraft/.env:
MCRCON_PORT="25575"
MCRCON_PASS="password"
What about systemd? I have a unit file:
... EnvironmentFile=/opt/minecraft/.env ... ExecStop=mcrcon save-all stop ...
/opt/minecraft/.env:
MCRCON_PORT="25575" MCRCON_PASS="password"
It should work. Does it work?
No, that's why I'm asking about it.
Could you paste your entire unit file and output of sudo systemctl status NAME_OF_THE_UNIT
after you try to start the unit?
Unfortunately my server just had a catastrophic failure, so it's gonna take me a while to get back to the point I can provide that. Will update when I can.
Closing this issue.
Please open new one if issue persists.
Both in systemd and via bash script I can't get mcrcon to recognize my environment variables unless I
export
them, which systemd doesn't do. This is non-standard behavior for reading environment variables, which means they can't be used with systemd.I was expecting
Connection failed
on the first run ofmcrcon
, gotYou must give password (-p password).
instead.