Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Use the executable created by linuxgsm #74

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

PJGame841
Copy link

When the linuxgsm creates the game server executable file, the entrypoint is assuming $GAMESERVER is the name of the exec.
Or if the exec has been created before but is not executable (by the touch command) the linuxgsm will install a new instance (which have "-2" added to its name) but the script doesn't use this new name.
So I just did a grep to get the new file name, and then replace the GAMESERVER env variable. This new value is then used to install, update and start the server.

Comment on lines +39 to +42
exec_name=$(./linuxgsm.sh ${GAMESERVER} | grep -o ${GAMESERVER}-. | head -1)
if [ ! -z "$exec_name" ]; then
export GAMESERVER=$exec_name
fi

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a better way of doing this would be using a bash parameter expansion substring

A REPL for this is available here

Suggested change
exec_name=$(./linuxgsm.sh ${GAMESERVER} | grep -o ${GAMESERVER}-. | head -1)
if [ ! -z "$exec_name" ]; then
export GAMESERVER=$exec_name
fi
./linuxgsm.sh ${GAMESERVER%-*}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may need to alter other parts of the script as well (such as exit_handler())

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants