-
Notifications
You must be signed in to change notification settings - Fork 4
Develop scripts #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I ran |
| def run_server_script(args): | ||
| # Start the server.py script as a new process group | ||
| process = subprocess.Popen( | ||
| ['python3', 'server.py', '--g-port', args.g_port], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are using python, why create a separate process?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to make it similar to start-team.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can check if the user has curl or wget
#!/bin/sh
# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Determine which command to use for downloading
if command_exists wget; then
DOWNLOAD_CMD="wget"
elif command_exists curl; then
DOWNLOAD_CMD="curl"
else
echo "Neither wget nor curl is installed. Please install one of them to proceed."
exit 1
fi
# Check if proxy directory exists, if exists, remove it
if [ -d proxy ]; then
echo "proxy directory exists, removing it"
rm -rf proxy
fi
mkdir proxy
cd proxy
# Download soccer simulation proxy
if [ "$DOWNLOAD_CMD" = "wget" ]; then
wget $(curl -s "https://api.github.com/repos/clsframework/soccer-simulation-proxy/releases/latest" | grep -oP '"browser_download_url": "\K[^"]*' | grep "soccer-simulation-proxy.tar.gz")
elif [ "$DOWNLOAD_CMD" = "curl" ]; then
curl -LO $(curl -s "https://api.github.com/repos/clsframework/soccer-simulation-proxy/releases/latest" | grep -oP '"browser_download_url": "\K[^"]*' | grep "soccer-simulation-proxy.tar.gz")
fi
tar -xvf soccer-simulation-proxy.tar.gz
mv soccer-simulation-proxy/* .
rm -rf soccer-simulation-proxy
rm soccer-simulation-proxy.tar.gz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also here :
#!/bin/sh
# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Determine which command to use for downloading
if command_exists wget; then
DOWNLOAD_CMD="wget"
elif command_exists curl; then
DOWNLOAD_CMD="curl"
else
echo "Neither wget nor curl is installed. Please install one of them to proceed."
exit 1
fi
# Check if rcssserver directory exists, if exists, remove it
if [ -d rcssserver ]; then
echo "rcssserver directory exists, removing it"
rm -rf rcssserver
fi
mkdir rcssserver
cd rcssserver
# Download soccer simulation server App Image
if [ "$DOWNLOAD_CMD" = "wget" ]; then
wget $(curl -s https://api.github.com/repos/clsframework/rcssserver/releases/latest | grep -oP '"browser_download_url": "\K(.*rcssserver-x86_64-.*\.AppImage)' | head -n 1)
elif [ "$DOWNLOAD_CMD" = "curl" ]; then
curl -LO $(curl -s https://api.github.com/repos/clsframework/rcssserver/releases/latest | grep -oP '"browser_download_url": "\K(.*rcssserver-x86_64-.*\.AppImage)' | head -n 1)
fi
# Check if download is successful
if [ ! -f rcssserver-x86_64-*.AppImage ]; then
echo "Download failed"
exit 1
fi
mv rcssserver-x86_64-*.AppImage rcssserver
chmod +x rcssserver
some script added
for downloading the rcssserver and proxy
to run a team with python or bash (team = proxy + thrift server)
how to test:
1- download server: cd scripts && ./download-rcssserver.sh
2- download proxy: cd scripts && ./download-proxy.sh
3- run server from scripts/rcssserver
4- Create a python env and active it (install requirements) (without requirements, the script should raise errors)
5- run start-team.sh
./start-team.sh -t a --g-port 50001
./start-team.sh -t b --g-port 50002
or run start-team.py
python start-team.py -t a --g-port 50001
python start-team.py -t b --g-port 50002
by exiting the script (python or bash) it should kill server and agents