mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 23:13:17 +00:00
34 lines
731 B
Bash
Executable File
34 lines
731 B
Bash
Executable File
#!/bin/sh
|
|
if ! [ $# -ge 1 ]; then
|
|
echo "Syntax: $0 <server version> [message]" >&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
|
|
shift
|
|
if [ "$*" = "" ]; then
|
|
message="The server will get restarted now. Please don't forget to save your game!"
|
|
echo "Sending standard message: $message"
|
|
else
|
|
message=$*
|
|
fi
|
|
|
|
if ! [ -e $SOCKET ]; then
|
|
echo "$SOCKET not found, sending to 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
|
|
|
|
echo "msg $message" > $SOCKET
|
|
|