wesnoth/utils/mp-server/send_server_command
Gunter Labes 7fa4661094 send error messages to STDERR
get the server port from the redirect.cfg (which needs to be changed anyway)
2008-04-26 18:10:52 +00:00

26 lines
554 B
Bash
Executable file

#!/bin/sh
if ! [ $# -ge 2 ]; then
echo "Syntax: $0 <server version> <command [arguments]>" >&2
exit 1
fi
SERVER=$1
SERVERBASE=$HOME/servers/$SERVER
SOCKET=$SERVERBASE/build/var/run/socket
if ! [ -d "$SERVERBASE" ]; then
echo "Server '$SERVER' not found." >&2
exit 1
fi
if ! [ -e $SOCKET ]; then
echo "$SOCKET not found, using the 'oldbuild'." >&2
SOCKET=$SERVERBASE/oldbuild/var/run/socket
fi
if ! [ -p $SOCKET ]; then
echo "$SOCKET is not a named pipe (fifo)." >&2
echo "Is the $SERVER server running?" >&2
exit 1
fi
shift
echo $* > $SOCKET