mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
676b0f88cf
Fixes #1393
19 lines
469 B
Bash
Executable File
19 lines
469 B
Bash
Executable File
#!/bin/bash
|
|
|
|
: "${CONSOLE_IN_NAMED_PIPE:=/tmp/minecraft-console-in}"
|
|
|
|
if [ $# = 0 ]; then
|
|
echo "ERROR: pass console commands as arguments"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then
|
|
echo "ERROR: named pipe ${CONSOLE_IN_NAMED_PIPE} is missing"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$(id -u)" = 0 ]; then
|
|
gosu minecraft bash -c "echo $* > '${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}'"
|
|
else
|
|
echo "$@" > "${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}"
|
|
fi |