[GH-ISSUE #2764] Pre/Post hooks #1995

Open
opened 2026-02-27 03:00:15 +03:00 by kerem · 0 comments
Owner

Originally created by @HeapUnderfl0w on GitHub (Mar 18, 2020).
Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/2764

User Story

I am administrating several arkservers for a small community using LGSM, and i have found
myself in need of a Pre and/or Post hook system (Mainly Post-update, Pre-start).

This is due to a (not directly related) bug in SteamCMD that makes mods of >1GiB size fail to download on the first attempt, and i wanted to write a tool that basically handles that downloading instead of SteamCMD directly. But as i am using LGSM, i would have to either wrap the whole lgsm script (which would be possible, but not really elegant) or completely reinvent it for Ark.

Basic info

  • Distro: Debian GNU/Linux 9.12 (stretch)
  • Game: Ark Survival Evolved
  • Command: update / start
  • LinuxGSM version: v19.12.5

Further Information

Arguments

The hooks themselves dont need to provide a lot of information really, mainly 3 arguments.

  1. Game
  2. Instance Name
  3. Install Path

The motivation for using args (or, if needed environment variables) is that it does not rely on any bash-internals, and thus hooks can be written in any language that can be called as a file.
(bash, python, nodejs, it would even enable the use of things like sciptisto or directly compiling the hook to a binary.

Installation

I would envision either a simple directory like hooks under the default lgsm config path
or a more complicated hooks/[pre|post]-[target] directory where multiple scripts get executed in alphabetical order order (with target being the name of the command, like start, stop, ...).

Running

Given the 3 arguments specified above lgsm should only have to call the script / program like this
(with LGSM_DIR being the lgsm install directory)

$LGSM_DIR/hooks/post-update arkserver yourfancyinstance /home/arkuser/serverfiles/

Additionally, if 1 hook exits with a non 0 exit code, lgsm should abort completly.

Further Reading

Here i was mainly inspired by both pacman Pre/Post Transaction hooks and git hooks

Originally created by @HeapUnderfl0w on GitHub (Mar 18, 2020). Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/2764 ## User Story I am administrating several arkservers for a small community using LGSM, and i have found myself in need of a Pre and/or Post hook system (Mainly Post-update, Pre-start). This is due to a (not directly related) bug in SteamCMD that makes mods of >1GiB size fail to download on the first attempt, and i wanted to write a tool that basically handles that downloading instead of SteamCMD directly. But as i am using LGSM, i would have to either wrap the whole lgsm script (which would be possible, but not really elegant) or completely reinvent it for Ark. ## Basic info * **Distro:** Debian GNU/Linux 9.12 (stretch) * **Game:** Ark Survival Evolved * **Command:** update / start * **LinuxGSM version:** v19.12.5 ## Further Information ### Arguments The hooks themselves dont need to provide a lot of information really, mainly 3 arguments. 1. Game 2. Instance Name 3. Install Path The motivation for using args (or, if needed environment variables) is that it does not rely on any bash-internals, and thus hooks can be written in any language that can be called as a file. (bash, python, nodejs, it would even enable the use of things like [sciptisto](https://github.com/igor-petruk/scriptisto) or directly compiling the hook to a binary. ### Installation I would envision either a simple directory like `hooks` under the default lgsm config path or a more complicated `hooks/[pre|post]-[target]` directory where multiple scripts get executed in alphabetical order order (with target being the name of the command, like `start`, `stop`, ...). ### Running Given the 3 arguments specified above lgsm should only have to call the script / program like this (with LGSM_DIR being the lgsm install directory) ```sh $LGSM_DIR/hooks/post-update arkserver yourfancyinstance /home/arkuser/serverfiles/ ``` Additionally, if 1 hook exits with a non 0 exit code, lgsm should abort completly. ## Further Reading Here i was mainly inspired by both `pacman` [Pre/Post Transaction hooks](https://wiki.archlinux.org/index.php/Pacman#Hooks) and `git` [hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks)
Sign in to join this conversation.
No labels
Atomic
Epic
cannot reproduce
command: backup
command: console
command: debug
command: details
command: fast-dl
command: install
command: mods
command: monitor
command: post-details
command: restart
command: send
command: start
command: stop
command: update
command: update-lgsm
command: validate
command: wipe
distro: AlmaLinux
distro: Arch Linux
distro: CentOS
distro: Debian
distro: Fedora
distro: RedHat
distro: Rocky Linux
distro: Ubuntu
distro: openSUSE
engine: goldsrc
engine: source
game: 7 Days to Die
game: ARMA 3
game: Ark: Survival Evolved
game: Assetto Corsa
game: Avorion
game: BATTALION: Legacy
game: Barotrauma
game: Battalion 1944
game: Battlefield 1942
game: Black Mesa: Deathmatch
game: Blade Symphony
game: Call of Duty 2
game: Call of Duty 4
game: Call of Duty: United Offensive
game: Counter-Strike 1.6
game: Counter-Strike 2
game: Counter-Strike: Global Offensive
game: Counter-Strike: Source
game: Day of Infamy
game: Dayz
game: Death Match Classic
game: Don't Starve Together
game: ET: Legacy
game: Eco
game: Factorio
game: Factorio
game: Garry's Mod
game: Half-Life
game: Hurtword
game: Insurgecy
game: Insurgecy
game: Insurgency: Sandstorm
game: Just Cause 3
game: Killing Floor
game: Killing Floor 2
game: Left 4 Dead 2
game: Minecraft
game: Minecraft Bedrock
game: Mordhau
game: Multi Theft Auto
game: Mumble
game: Natural Selection 2
game: No More Room in Hell
game: Pavlov VR
game: Post Scriptum
game: Project Zomboid
game: Quake 3
game: QuakeWorld
game: Red Orchestra: Ostfront 41-45
game: Return to Castle Wolfenstein
game: Rising World
game: Rust
game: San Andreas Multiplayer
game: Satisfactory
game: Soldat
game: Soldier of Fortune 2
game: Squad
game: Squad 44
game: Starbound
game: Stationeers
game: Sven Co-op
game: Team Fortress 2
game: Teamspeak 3
game: Teeworlds
game: Terraria
game: The Front
game: Unreal Tournament 2004
game: Unreal Tournament 3
game: Unreal Tournament 99
game: Unturned
game: Valheim
game: Wurm Unlimited
game: Zombie Master Reborn
game: label missing
good first issue
help wanted
info: alerts
info: dependency
info: docker
info: docs
info: email
info: query
info: steamcmd
info: systemd
info: tmux
info: website
info: website
needs more info
outcome: duplicate
outcome: issue resolved
outcome: issue resolved
outcome: issue unresolved
outcome: pr accepted
outcome: pr rejected
outcome: unconfirmed
outcome: wontfix
outcome: wrong forum
potential-duplicate
priority
pull-request
type: bug
type: feature
type: feature
type: feature request
type: game server request
type: refactor
waiting response
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/LinuxGSM#1995
No description provided.