simworld/scripts/run.sh
2024-11-14 15:21:36 -06:00

47 lines
831 B
Bash
Executable File

#!/bin/sh
set -e
if ! [ -d ".git" ]; then
echo "Run in the project root"
exit 1
fi
OPTIND=1
server_args=""
client1_args=""
client2_args=""
client3_args=""
while getopts "d:1:2:3:" opt; do
case "${opt}" in
d) server_args="${OPTARG}" ;;
1) client1_args="${OPTARG}" ;;
2) client2_args="${OPTARG}" ;;
3) client3_args="${OPTARG}" ;;
*) echo "Invalid flag"; exit 1
esac
done
shift $((OPTIND - 1))
[ "${1:-}" = "--" ] && shift
./scripts/build.sh
echo "### DAEMON ###"
./build/server/simworld-daemon ${server_args} &
sleep 1
echo "### CLIENT 1 ###"
./build/client/simworld-client ${client1_args}
echo "### CLIENT 2 ###"
./build/client/simworld-client ${client2_args}
echo "### CLIENT 3 ###"
sleep 1
./build/client/simworld-client ${client3_args}
killall simworld-daemon