mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-29 14:33:18 +00:00
33 lines
672 B
Bash
Executable File
33 lines
672 B
Bash
Executable File
#!/bin/sh
|
|
if ! [ $# -ge 1 ]; then
|
|
echo "Syntax: $0 <server version> [message]"
|
|
exit 1
|
|
fi
|
|
|
|
SERVER=$1
|
|
SERVERBASE=$HOME/servers/$SERVER
|
|
SOCKET=$SERVERBASE/build/var/run/socket
|
|
if ! [ -d "$SERVERBASE" ]; then
|
|
echo "Server '$SERVER' not found."
|
|
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'."
|
|
SOCKET=$SERVERBASE/oldbuild/var/run/socket
|
|
fi
|
|
if ! [ -p $SOCKET ]; then
|
|
echo "$SOCKET is not a named pipe (fifo)"
|
|
exit 1
|
|
fi
|
|
|
|
echo "msg $message" > $SOCKET
|
|
|