Skip to content

appaKappaK/tmodloaderserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

174 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

tModLoader Server Management

Version tModLoader License Platform

A headless server management toolkit for tModLoader with Steam Workshop integration, automated backups, world management, mod config editing, and diagnostics β€” all driven from a single interactive CLI menu.


πŸ“ Directory Structure

~/servers/tmodloader/ β”œβ”€β”€ Engine/ # tModLoader server files (managed by SteamCMD) β”œβ”€β”€ Mods/ # Installed .tmod files + enabled.json β”œβ”€β”€ Worlds/ # World save files β”œβ”€β”€ ModConfigs/ # Per-mod config files (JSON, TOML, etc.) β”œβ”€β”€ Configs/ # serverconfig.txt, workshop_map.json β”œβ”€β”€ Backups/ # Automated backup storage β”‚ β”œβ”€β”€ Worlds/ β”‚ β”œβ”€β”€ Configs/ β”‚ └── Full/ β”œβ”€β”€ Logs/ # All script and server logs └── Scripts/ β”œβ”€β”€ core/ # tmod-core.sh, tmod-server.sh, tmod-monitor.sh β”œβ”€β”€ hub/ # tmod-control.sh ← main entry point β”œβ”€β”€ backup/ # tmod-backup.sh β”œβ”€β”€ steam/ # tmod-workshop.sh, tmod-deps.sh, mod_ids.txt └── diag/ # tmod-diagnostics.sh 

πŸ“¦ Requirements

System Dependencies

Debian / Ubuntu

sudo apt update -y sudo apt install -y git screen curl jq pigz rsync unzip htop ncdu net-tools dos2unix

Fedora / RHEL / CentOS (untested β€” community contributions welcome)

sudo dnf install -y git screen curl jq pigz rsync unzip htop ncdu net-tools dos2unix

Note: pigz and dos2unix may require the EPEL repository on RHEL/CentOS.

SteamCMD

Debian / Ubuntu

sudo dpkg --add-architecture i386 sudo apt update -y sudo apt install -y steamcmd

Fedora / RHEL / all others (manual install) (untested β€” community contributions welcome)

mkdir -p ~/servers/steam/SteamCMD curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" \ | tar -xzf - -C ~/servers/steam/SteamCMD

If using the manual install, update steamcmd_path in Configs/serverconfig.txt to match your install path.

tModLoader Server Files

steamcmd \ +force_install_dir ~/servers/tmodloader/Engine \ +login anonymous \ +app_update 1281930 validate \ +quit

.NET Runtime

No manual installation needed. On first server start the scripts automatically:

  1. Read the required .NET version from Engine/tModLoader.runtimeconfig.json
  2. Run tModLoader's bundled Engine/LaunchUtils/InstallDotNet.sh
  3. Install the correct runtime into Engine/dotnet/

Install progress is logged to Logs/dotnet-install.log. If the install fails, check that file for details.


βš™οΈ Setup

After cloning, run once to create required directories, copy example configs, and set script permissions:

make setup

Then edit Configs/serverconfig.txt β€” at minimum set steamcmd_path to match your SteamCMD install location.


πŸš€ Usage

All management goes through Scripts/hub/tmod-control.sh. Run with no arguments to open the interactive menu:

./Scripts/hub/tmod-control.sh # or from the hub directory: ./tmod-control.sh # with debug logging to terminal: ./tmod-control.sh --debug

Every page shows a live status bar with server state, uptime, player count, mod count, active world, folder sizes, and disk usage.

Interactive Menu

# Section Description
1 Server Start, stop, restart, status, world management
2 Mods Add, enable/disable, mod configs, workshop tools
3 Monitoring Dashboard, live log tail, console attach
4 Backup Create, restore, verify, cleanup
5 Maintenance Diagnostics, update engine, emergency shutdown

Server Page

# Option
1 Show Status
2 Start Server
3 Stop Server
4 Restart Server
5 Select Active World
6 Start with World Select
7 Create New World
8 Import World (from uploaded .wld file)

Select World β€” lists all .wld files with size, last modified, and marks the currently active world. Updates serverconfig.txt automatically.

Create New World β€” generates a world headlessly via tModLoader's -autocreate. Prompts for name, size, difficulty, and seed.

Import World β€” paste the path to a pre-uploaded .wld file. Copies it into Worlds/, optionally renames it, sets it as active, and optionally starts the server.


Mods Page

# Option
1 Add Mod by URL or ID
2 Show mod_ids.txt
3 Clear mod_ids.txt
4 Mod Picker (interactive toggle)
5 Enable a Mod
6 Disable a Mod
7 List Mods (enabled/disabled)
8 List Installed Mods
9 Check for Errors
10 Workshop Status
11 List Workshop Downloads
12 Archive Old Versions
13 Cleanup Downloads
14 Mod Configs (edit per-mod settings)

Add Mod by URL or ID β€” paste one or more Steam Workshop URLs (including concatenated multi-URL strings). Automatically extracts all ?id= values, adds them to mod_ids.txt, and optionally downloads + syncs immediately.

Mod Configs β€” scans ModConfigs/ and any mod-created subdirectories (e.g. TerrariaOverhaul/) for config files. Select one to open in nano.


Backup Page

# Option
1 Backup Status
2 World Backup
3 Config Backup
4 Full Server Backup
5 Auto Backup (all three)
6 List Backups
7 Restore from Backup
8 Verify a Backup
9 Cleanup Old Backups
10 View Backup Log

Restore and Verify use an inline file picker that scans all backup subdirectories.


Monitoring Page

# Option
1 Status Dashboard
2 Health Check
3 Live Monitor (continuous)
4 Follow Server Log (tail -f)
5 View Server Log (last 50)
6 View Monitor Log
7 View Control Log
8 Attach to Server Console

βš™οΈ Configuration

Configs/serverconfig.txt

serverconfig.txt is not tracked in git (machine-specific paths). A clean template is provided:

cp Configs/serverconfig.example.txt Configs/serverconfig.txt

Then edit serverconfig.txt for your machine. The world= and worldname= keys are managed automatically by the world picker β€” leave them commented out initially. The tmod-scripts section at the bottom holds script-specific settings:

# ─── tmod-scripts ───────────────────────────────────────────────────────────── steamcmd_path=~/servers/steam/SteamCMD/steamcmd.sh log_max_size=10M # Rotate logs larger than this (e.g. 5M, 10M, 50M) log_keep_days=14 # Delete compressed old logs after this many days

Paths support ~/ expansion.

Secrets

Sensitive values (STEAM_API_KEY, STEAM_USERNAME) should be exported from ~/.bashrc_secrets or equivalent β€” not stored in any tracked file.

mod_ids.txt

mod_ids.txt is not tracked in git (personal mod list). A clean template is provided:

cp Scripts/steam/mod_ids.example.txt Scripts/steam/mod_ids.txt

Then add your Workshop URLs or numeric IDs β€” one per line. Managed via the menu (Mods β†’ Add Mod by URL or ID) or edited directly. Lines starting with # are ignored.

workshop_map.json

Optional at Configs/workshop_map.json. Maps mod names to Workshop IDs for use by tmod-deps.sh:

{ "MyMod": "1234567890" }

πŸ”§ Diagnostics

./Scripts/diag/tmod-diagnostics.sh full # Full system check ./Scripts/diag/tmod-diagnostics.sh quick # Fast essential checks ./Scripts/diag/tmod-diagnostics.sh binaries # Check tModLoader binary ./Scripts/diag/tmod-diagnostics.sh config # Check config files ./Scripts/diag/tmod-diagnostics.sh fix # Auto-fix common issues ./Scripts/diag/tmod-diagnostics.sh report # Generate shareable report

πŸ“‹ CLI Reference

# Server ./tmod-control.sh start ./tmod-control.sh stop ./tmod-control.sh restart ./tmod-control.sh status # Backup ./tmod-control.sh backup worlds ./tmod-control.sh backup configs ./tmod-control.sh backup full ./tmod-control.sh backup auto # Monitoring ./tmod-control.sh monitor status ./tmod-control.sh monitor start ./tmod-control.sh monitor logs # Workshop ./tmod-control.sh workshop download ./tmod-control.sh workshop sync ./tmod-control.sh workshop list ./tmod-control.sh workshop archive ./tmod-control.sh workshop cleanup

πŸ“ Changelog

v2.5.0 β€” 2026-03-01

Menu & UX

  • Removed obsolete Download Mods and Sync Mods menu items β€” superseded by URLβ†’enabled.json system
  • Restructured all 5 menu pages for better headless-server UX flow
  • Monitoring page expanded from 4 to 8 items: Status Dashboard, Health Check, Live Monitor, Follow Server Log (tail -f), View Server/Monitor/Control Logs, Attach to Server Console (screen -r)
  • Backup page expanded from 4 to 10 items: inline restore and verify file pickers, config/full/auto backups, cleanup, log view
  • Mods page: added Mod Configs editor (item 14) β€” browses ModConfigs/ and mod subdirs, opens selected file in nano
  • Server page: added Import World (item 8) β€” copy a pre-uploaded .wld, rename, set active, optionally start

Logging

  • log_it and log_control now write to file only by default β€” no terminal noise for INFO messages
  • WARN / ERROR / CRITICAL always print to terminal
  • --debug flag exports TMOD_DEBUG=1 to all child scripts, enabling full verbose output

Configuration

  • Directories renamed to match tModLoader convention: Engine/, Configs/, Logs/, Backups/, Scripts/
  • Backup subdirectories capitalised: Backups/Worlds/, Backups/Configs/, Backups/Full/
  • STEAMCMD_PATH moved from .env to serverconfig.txt (steamcmd_path=)
  • Log rotation thresholds now configurable in serverconfig.txt (log_max_size, log_keep_days)
  • rotate_logs() improved: timestamped rolling archives, worldgen.log excluded
  • server_config_get() helper added to core for reading script settings from serverconfig.txt

Cleanup

  • Whitelist system removed β€” player management is better handled by in-game admin mods
  • Secrets (STEAM_API_KEY, STEAM_USERNAME) moved to ~/.bashrc_secrets
  • *.bak files excluded from git
  • Scripts/steam/mod_ids.txt now gitignored (personal mod list); mod_ids.example.txt added as tracked template
  • create_example_mod_ids_file() copies from mod_ids.example.txt when bootstrapping a fresh install

🀝 Contributing

Issues, feature requests, and pull requests are welcome.

πŸ“„ License

Apache 2.0 β€” see LICENSE for details.

Releases

No releases published

Packages

 
 
 

Contributors