Skip to content
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

Added optional pre_restart script to be called when monitor restarts … #4556

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dualarrow
Copy link

These changes allows a script named "pre_restart" to be run (only if it exists) when the monitor command determines a server restart is required.

This is to allow rust updates and oxide updates to be performed when monitor detects a restart is required. Without this, plugins like SmoothRestarter (which can detect a rust and/or oxide update) only stops the server. As rustserver currently stands, the monitor command (as I understand it) only restarts the server and is not able to perform a rust or oxide update.

@MicLieg
Copy link
Contributor

MicLieg commented Apr 23, 2024

Thanks for the PR. That's a great idea!

However using the built in fixes feature is probably the better way of achieving this.
See https://dev-docs.linuxgsm.com/getting-started/adding-a-new-game-server#add-any-fixes-to-a-fix-file

Rust already uses some (pre_start) fixes: https://github.com/GameServerManagers/LinuxGSM/blob/master/lgsm/modules/fix_rust.sh

@dualarrow
Copy link
Author

I tried that, but it doesnt seem to work.

I added the following to core_modules.sh

fix_rust.sh() {
        modulefile="${FUNCNAME[0]}"
        fn_fetch_module
}

fix_rusticraiders.sh() {
        modulefile="${FUNCNAME[0]}"
        fn_fetch_module
}

I added the following to fix.sh

apply_pre_start_fix=(arma3 armar ark av bt bo csgo cmw dst hw ins kf nmrih onset pvr ro rusticraiders rust rw samp sdtd sfc sof2 squad st tf2 terraria ts3 mcb mta unt vh wurm zmr)

and the fix_rusticraiders.sh is

#!/bin/bash
# LinuxGSM fix_rusticraiders.sh module
# Author: Andrew Cumming
# Contributors: http://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Run some specific tasks before startup

moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"

echo "SIGN HERE" >./sign.txt

The game starts ok, but my script seems to have not executed.
Can you see anything obviously wrong in my example ?

@MicLieg
Copy link
Contributor

MicLieg commented May 1, 2024

Currently, each game only has a single fix file containing one or more fixes.

You just need to copy your new code from fix_rusticraiders.sh to fix_rust.sh. There is no need to create a new fix file, as rust already has one: https://github.com/GameServerManagers/LinuxGSM/blob/master/lgsm/modules/fix_rust.sh

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

Successfully merging this pull request may close these issues.

None yet

3 participants