This is a modification to the setup recommended by the minecraft wiki at https://minecraft.fandom.com/wiki/Tutorials/Server_startup_script. Start by following the directions there, then modify to match what's here.
This allows control over stdin of the server by piping commands to %i/%v/mc.stdin
. ie: echo "say Hello" > /run/survival/mc.stdin
%i
is your systems runtime directory (mine is /run
%v
is your servers name, explained in the wiki linked