Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternate separator for RCON_CMDS_ #3007

Closed
quulah opened this issue Jul 21, 2024 · 2 comments · Fixed by #3008
Closed

Alternate separator for RCON_CMDS_ #3007

quulah opened this issue Jul 21, 2024 · 2 comments · Fixed by #3008

Comments

@quulah
Copy link
Contributor

quulah commented Jul 21, 2024

Enhancement Type

Improve an existing feature

Describe the enhancement

I'm trying to start the container as a Podman Quadlet. This means that it's just a normal systemd unit file, and there's no YAML involved, so I can't use |- quite as nicely as with Docker Compose for instance.

Since the scripts seem to use while read -r to go through the commands, I'm currently not able to pass multiple commands to run.

For example, this does not seem to work:

RCON_CMDS_STARTUP="gamerule disableElytraMovementCheck false\ngamerule playersSleepingPercentage 0"

systemd does seem to support newlines in such a way, but it's possibly the Podman integration here that interferes and this just goes in to the container verbatim:

# env | grep CMDS
RCON_CMDS_STARTUP="gamerule disableElytraMovementCheck false\ngamerule playersSleepingPercentage 0"

And then it fails like so:

[Rcon loop] Unknown or incomplete command, see below for error"gamerule disableElytraMovementCheck false\ngamerule playersSleepingPercentage 0"<--[HERE]

I'd be happy if we can turn the literal \n into an actual newline, so the current implementation works, or as the title suggest if there would be a way to separate multiple commands with another known separator that'd be nice too. :)

@itzg
Copy link
Owner

itzg commented Jul 21, 2024

I just recently discovered echo -e. Using that at the loop might work to interpret the escaped newlines. It would be great if you could submit a PR for that.

@quulah
Copy link
Contributor Author

quulah commented Jul 21, 2024

Thanks!

Tested it quickly. At least in my use case of Podman Quadlet and the EnvironmentFile= the variables need to be set without any quotation marks like so:

RCON_CMDS_STARTUP=gamerule disableElytraMovementCheck false\ngamerule playersSleepingPercentage 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants