Skip to content

Commit daccd79

Browse files
dgibbs64gitbook-bot
authored andcommitted
GITBOOK-30: change request with no subject merged in GitBook
1 parent 1ac9adb commit daccd79

4 files changed

Lines changed: 25 additions & 36 deletions

File tree

code-standards/commands.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
# Commands
22

3-
Within LInuxGSM there are many commands that a user will run to complete tasks such as start, stop, monitor, and details. Command scripts are stored will all other modules and are always named something like `command_install.sh`.
3+
Within LinuxGSM there are many commands that a user will run to complete tasks such as start, stop, monitor, and details. Command scripts are stored with all other modules and are always named something like `command_install.sh`.
44

5-
Here are the command functions you might need to alter when adding a new server:
6-
7-
* command\_install.sh - Server installation must work properly
8-
* command\_update.sh - if the given game supports updates (might required to add a file for that matter, for now, we use to add a single file for install and update, like for TeamSpeak 3).
9-
* command\_details.sh - Server details need to be displayed properly
10-
* command\_monitor.sh & monitor\_gsquery.sh, query\_gsquery.py & query\_gsquery.py - You'll need to read carefully and understand this code before altering it.
11-
* core\_getopt.sh - You will define available commands in this one, displayed when the user runs `./gameserver` without an argument. Either use an existing opt or make a new one if needed.
12-
* command\_start.sh & command\_stop.sh - Of course, your server needs to be able to start and stop properly.
13-
* command\_debug.sh & command\_console.sh - Those commands usually work out of the box, but might require some more work. If not using tmux, then console should be disabled for this server in core\_getopt.sh.
14-
* info\_config.sh - You might need to read variables out of configuration files such as Rcon information in the case of Squad.
5+
Some game servers may require bespoke commands to complete tasks. Examples of this include Teamspeak 3 and Unreal Tournament 2004. Take a look at the `core_getopts.sh` module for examples of how to add commands.

code-standards/functions.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
# Functions
22

3-
Functions are groupings of code that complete a task \(function\). These functions can be called upon anywhere within the code. Creating a function prevents having to replicat the same code over and over.
3+
Functions are groupings of code that complete a task (function). These functions can be called upon anywhere within the code. Creating a function prevents having to replicate the same code over and over.
44

55
## LinuxGSM Functions
66

7-
All functions within LinuxGSM begin with an prefix `fn_` and should be descriptive of what the function is doing. Words are separated by an underscore `_`.
7+
All functions within LinuxGSM begin with the prefix `fn_` and should be descriptive of what the function is doing. Words are separated by an underscore `_`.
88

9-
For LinuxGSM development, it is important that developers understand what a function does which is why all function names must describes the propose of the function. A longer function name that describes the function is prevered over a short one that does not.
9+
For LinuxGSM development, it is important that developers understand what a function does which is why all function names must describe the purpose of the function. A longer function name that describes the function is preferred over a short one that does not.
1010

1111
### Examples
1212

13-
```text
13+
```
1414
fn_stop_graceful_cmd
1515
```
1616

17-
```text
17+
```
1818
fn_update_ts3_dl
1919
```
2020

2121
### Syntax
2222

2323
All functions should be formatted with the following syntax.
2424

25-
```text
25+
```
2626
fn_function_name(){
2727
code
2828
}
2929
```
30-

code-standards/modules.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ Modules are individual bash scripts containing code and functions that complete
66
77
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.
88

9-
Modules are located in the `functions` directory,
9+
Modules are located in the `modules` directory,
1010

11-
```text
12-
lgsm/functions
11+
```
12+
lgsm/modules
1313
```
1414

1515
### Module Groups
1616

17-
Modules are split into logical groups depending upon the type of task is being carried out.
17+
Modules are split into logical groups depending on the type of task being carried out.
1818

1919
* alert – Sending alert notifications
2020
* check – completes checks before a command runs.
2121
* command – the command module that runs specific command tasks.
2222
* core – core modules that are required to run LinuxGSM.
23-
* fix – apply game server specific fixes to allow the game server to run correctly.
23+
* fix – apply game server-specific fixes to allow the game server to run correctly.
2424
* info – gathers info from sources such as the OS and game server.
2525
* install - modules related to installation
2626
* mods – handles game server mods
@@ -41,7 +41,7 @@ Core modules handle vital are required by LinuxGSM. These include download, geto
4141

4242
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:
4343

44-
```text
44+
```
4545
core
4646
command
4747
check
@@ -52,7 +52,7 @@ It is possible to see the order that modules run by enabling `./gameserver dev`.
5252

5353
Example output of `./gameserver stop`
5454

55-
```text
55+
```
5656
+ core_functions.sh
5757
++ core_legacy.sh
5858
++ core_messages.sh
@@ -83,14 +83,13 @@ Example output of `./gameserver stop`
8383

8484
## How Modules are Called
8585

86-
In bash to call another bash script the `source` command is used. However, in LinuxGSM this is handled by the `core_functions.sh` module. This allows LinuxGSM automatically download a module the first time it is used then call the script.
86+
In bash to call another bash script, the `source` command is used. However, in LinuxGSM this is handled by the `core_modules.sh` module. This allows LinuxGSM to automatically download a module the first time it is used and then call the script.
8787

8888
To call a module simply add the name of the module file e.g `info_config.sh` and the module will be called. If a new module is being added it must be added to the list of modules in `core_functions.sh` like so.
8989

90-
```text
90+
```
9191
info_config.sh(){
9292
functionfile="${FUNCNAME}"
9393
fn_fetch_function
9494
}
9595
```
96-

getting-started/adding-a-new-game-server.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ Some common variables that will need updating:
2424
* Game Server Details `gamename` , `engine`, `glibc`.
2525
* Various directory and config variables.
2626

27-
### Add the new server to serverlist.csv
27+
## Add the new server to serverlist.csv
2828

2929
Add the new server details to `serverlist.csv` as well as add any dependency requirements to all the distro csv files found in `lgsm/data` directory.
3030

31-
### Add any fixes to a fix file
31+
## Add any fixes to a fix file
3232

3333
Some game servers require alterations before they can start common examples include:
3434

@@ -44,31 +44,31 @@ If this is required a fix module will need to be created.
4444
3. Add the module to `fix.sh`
4545
4. Add the fix to `core_modules.sh` list
4646

47-
### Server Querying
47+
## Server Querying
4848

4949
Game servers can often be queried to check the server is running and return useful info. LinuxGSM uses gsquery.py to complete simple pings and [gamedig](https://github.com/gamedig/node-gamedig) to get detailed info returned in json format. 
5050

5151
Most game servers use the valve protocol for allowing queries, however, others are available. Look for any developer documentation to try and find out if querying is supported. 
5252

5353
Use the `query-raw` command to assist in testing the querying of the new game server. 
5454

55-
### Stop Mode
55+
## Stop Mode
5656

5757
Game servers will be able to gracefully exit using various methods. Figure out the method the new game server uses. See [stop mode](https://docs.linuxgsm.com/features/stop-mode).
5858

59-
### Glibc Version
59+
## Glibc Version
6060

6161
Most game servers require a minimum glibc version. Use the `detect-glibc` command to find out the minimum glibc version required.
6262

63-
### Details
63+
## Details
6464

6565
Various game server info will need to be parsed from game server configs or variables. Use the info\_\*.sh modules to add this info. 
6666

67-
### Custom Updater
67+
## Custom Updater
6868

6969
Not all game servers use SteamCMD. If this is the case a custom update module will need to be created. There are a number of examples in the code that can be used as a baseline.
7070

71-
Custom Commands
71+
## Custom Commands
7272

7373
Some game servers may require bespoke commands to complete tasks. Examples of this include Teamspeak 3 and Unreal Tournament 2004. Take a look at the `core_getopts.sh` module for examples of how to add commands.
7474

0 commit comments

Comments
 (0)