Modules are individual bash scripts containing code and functions that complete specific tasks.
Modules may sometimes be referred to as function files or just functions are located in the functions directory and not be confused with bash functions. Modules have been named as such to avoid confusion.
A command will call upon modules to complete various command tasks. Modules are normally created if a task needs to be called upon by multiple commands, or as a logical way to split large commands and modules into smaller sub-modules.
Modules are located in the
Modules are split into logical groups depending upon the type of task is being carried out.
- alert – Sending alert notifications
- check – completes checks before a command runs.
- command – the command module that runs specific command tasks.
- core – core modules that are required to run LinuxGSM.
- fix – apply game server specific fixes to allow the game server to run correctly.
- info – gathers info from sources such as the OS and game server.
- install - modules related to installation
- mods – handles game server mods
- query – game server query modules
- update – handles updating of game servers and LinuxGSM
Some modules such as
check.share made up of smaller tasks that are split up into sub-modules. Because of this, these modules become pointers for their sub-modules that will upon the sub-modules as required.
An example of this is when check.sh will be called within command_start.sh, it will automatically select which sub-module tasks are required and run them.
Core modules handle vital are required by LinuxGSM. These include download, getopt, messages, exit, trap
Modules will launch in sequence as they are required by commands. The following modules will normally run in the following order when a command is executed:
It is possible to see the order that modules run by enabling
./gameserver dev. Once enabled the module order will be saved in
Example output of
In bash to call another bash script the
sourcecommand is used. However, in LinuxGSM this is handled by the
core_functions.shmodule. This allows LinuxGSM automatically download a module the first time it is used then call the script.
To call a module simply add the name of the module file e.g
info_config.shand the module will be called. If a new module is being added it must be added to the list of modules in