简体中文 · English
Manage Linux CS2 and CS:GO dedicated servers through tmux, with Chinese/English interfaces, editable configuration, and Tab completion. CS2 also supports SteamCMD updates, live logs, and post-update checks. Both controllers are standalone Bash programs.
Install to /usr/local/bin/ and choose a language at the prompt:
curl -fsSL https://raw.githubusercontent.com/RATING3PRO/csctl/main/install.sh | bashFor an English installation without a prompt:
curl -fsSL https://raw.githubusercontent.com/RATING3PRO/csctl/main/install.sh | bash -s -- --lang enUse --lang zh for Chinese. From a complete checkout:
bash install.sh # Choose interactively
bash install.sh --lang en # Install in English directlyThe installer prefers local files and needs no network access in a complete checkout. Standalone and piped installations download from GitHub's main branch using curl or wget. Non-root users installing to the default location are elevated with sudo.
Requirements: Linux, Bash 4+, tmux, util-linux (flock), and GNU coreutils. Switching users requires sudo; CS2 updates require working SteamCMD. The installer does not create game users or install SteamCMD.
# Basic runtime dependencies on Debian / Ubuntu
sudo apt install bash tmux sudo util-linux coreutils bash-completion| Component | Default location |
|---|---|
Controllers, mode 0755 |
/usr/local/bin/cs2ctl, /usr/local/bin/csgoctl |
| Bash completion | /usr/local/share/bash-completion/completions/cs2ctl, csgoctl |
| Zsh completion | /usr/local/share/zsh/site-functions/_csctl |
Configuration, created by the first -e |
/etc/cs2ctl.conf, /etc/csgoctl.conf |
Rerun the installer to upgrade or change the default language. Existing configuration and server state are preserved. All downloads and Bash syntax checks finish before installation begins. For a custom location, use PREFIX="$HOME/.local" bash install.sh --lang en; use DESTDIR for packaging.
The selected language is embedded in installed copies. It controls help, messages, errors, new configuration templates, and Zsh completion descriptions. Existing configuration comments, custom scripts, and output from SteamCMD, tmux, or system tools are not translated.
Interactive selection reads /dev/tty, including with curl | bash. Without a terminal, the default is Chinese; specify --lang en for unattended English installations. Installer precedence is --lang > CSCTL_LANGUAGE > interactive selection / Chinese fallback.
Override the installed default for a single invocation:
CSCTL_LANGUAGE=en cs2ctl --help
sudo CSCTL_LANGUAGE=en cs2ctl -e
sudo CSCTL_LANGUAGE=zh csgoctl statussudo cs2ctl -e # Set the user, working directory, and launch command
sudo cs2ctl start
sudo cs2ctl status
sudo cs2ctl attach # Ctrl-b, then d: detach and leave the server running
sudo cs2ctl stopFor CS:GO, replace cs2ctl with csgoctl.
| Command | Behavior |
|---|---|
start |
Start; do nothing if the session already exists |
stop |
Stop with tmux kill-session; succeed if already stopped |
restart |
Stop and start the server |
attach |
Open the tmux console |
status |
Show session name, window count, and attached clients; exit 0 when running or 3 when stopped |
chown |
Recursively set the owner and group of CHOWN_DIR to RUN_USER:RUN_USER |
update, CS2 only |
Stop → update → check → leave stopped; add --validate to verify all game files |
check, CS2 only |
Run post-update checks separately, with live and saved logs |
-e / --edit |
Edit and validate configuration before saving |
status checks session existence, not game readiness. stop closes the session directly and does not perform an in-game graceful shutdown.
Like crontab -e, -e creates a template on first use, opens $VISUAL, $EDITOR, or vi, then validates syntax and saves atomically. Failures preserve the original and report the retained edit-copy path. New files use mode 0600; existing permissions and ownership are preserved.
sudo EDITOR=nano cs2ctl -e
sudo EDITOR='vim -f' csgoctl -e
# Unprivileged configuration: set RUN_USER to your own username
cs2ctl -c "$HOME/.config/csctl/cs2.conf" -e
cs2ctl -c "$HOME/.config/csctl/cs2.conf" startAll commands accept -c FILE, --config FILE, and --config=FILE. Session mutations, ownership changes, updates, checks, and editing require a writable configuration directory for the lock file. Use sudo consistently for default /etc configuration.
| Setting | Purpose |
|---|---|
RUN_USER |
User running tmux, SteamCMD, and checks; default csgo |
SESSION |
Exact session name: letters, digits, underscores, and hyphens; no leading hyphen |
WORKDIR |
Absolute working directory for the game and checks |
CHOWN_DIR |
Absolute directory whose ownership is changed recursively by chown |
CMD |
Complete launch command executed by Bash |
STEAMCMD, CS2 only |
Executable name or absolute path, such as /usr/games/steamcmd, without arguments |
STEAM_INSTALL_DIR, CS2 only |
Installation root; empty omits force_install_dir |
UPDATE_LOG_DIR, CS2 only |
Absolute log directory; empty uses cs2ctl-logs/ beside the configuration |
POST_UPDATE_SCRIPT, CS2 only |
Multiline POSIX sh script run after a successful update |
Configuration is Bash code loaded by the caller and should only be edited by trusted administrators. Double quotes expand variables while loading; single quotes defer expansion until launch. Use $PWD in CMD for the working directory. Ordinary configuration variables are not automatically exported to the game. Switching users uses sudo -H -u and a Bash login environment; invocations already running as RUN_USER keep their current environment.
Set CHOWN_DIR using -e. New templates include these defaults; add the setting manually to existing configurations:
# /etc/cs2ctl.conf
CHOWN_DIR='/home/csgo/Steam/steamapps/common/Counter-Strike Global Offensive'
# /etc/csgoctl.conf
CHOWN_DIR='/home/csgo/Steam/steamapps/common/Counter-Strike Global Offensive Beta - Dedicated Server'Run:
sudo cs2ctl chown
sudo csgoctl chownThe command runs chown -R --preserve-root -- "$RUN_USER:$RUN_USER" "$CHOWN_DIR" as root, using sudo when necessary. Both owner and group use RUN_USER; that user and a group with the same name must exist. The actual directory path is resolved first; empty paths, missing directories, and the filesystem root are rejected. Failures preserve chown's exit status. This command needs neither tmux nor SteamCMD and does not start or stop servers.
sudo cs2ctl update # Normal update; stop automatically and leave stopped
sudo cs2ctl update --validate # Use when a full game-file verification is needed
sudo cs2ctl check # Check separately, including after fixing files
sudo cs2ctl start # Start manually after reviewing the resultBy default, the updater runs login anonymous → app_update 730 → quit as RUN_USER, with options to abort on failure and avoid password prompts. Only an explicit --validate adds validate to verify all game files. Normal updates do not request full verification, though SteamCMD may still perform checks needed for the update.
A nonempty STEAM_INSTALL_DIR adds force_install_dir before login. It must be the installation root, not game/bin/linuxsteamrt64, and correspond to the same installation as WORKDIR.
stdout/stderr are streamed and saved, by default under /etc/cs2ctl-logs/. Checks run only if SteamCMD exits 0 and reports that App 730 was successfully installed or is already up to date. Failed checks return nonzero. The controller always leaves the server stopped and prints a manual start command on success. Preparation or log-creation failures after stopping do not restart it.
The default check does nothing. Edit POST_UPDATE_SCRIPT with -e, for example to check a Metamod entry in the standard directory layout:
POST_UPDATE_SCRIPT=$(cat <<'CSCTL_POST_UPDATE'
# Adjust for your WORKDIR and required contents
file="$WORKDIR/../../csgo/gameinfo.gi"
test -f "$file" || { echo "File missing: $file" >&2; exit 1; }
grep -Fq 'Game csgo/addons/metamod' "$file" || {
echo 'Check failed: Metamod entry missing' >&2
exit 1
}
echo 'Checks passed'
# Or call an external script: sh /home/csgo/check-after-update.sh
CSCTL_POST_UPDATE
)Checks run with sh -eu in WORKDIR, with WORKDIR, SESSION, RUN_USER, and STEAM_INSTALL_DIR exported. Check important exit statuses explicitly: sh -e does not detect failures in the middle of a pipeline.
Bash normally loads completion through bash-completion. Enable it immediately with:
source /usr/local/share/bash-completion/completions/cs2ctlFor Zsh, add to ~/.zshrc:
fpath=(/usr/local/share/zsh/site-functions $fpath)
autoload -Uz compinit && compinitCommands, options, and configuration paths are completed. Adjust paths for a custom PREFIX. Completion after sudo cs2ctl … also requires your shell's sudo completion support.
- Manual updates work but scripted updates fail: compare
STEAM_INSTALL_DIR. If manual updates omitforce_install_dir, try an empty value for comparison and confirm that the updated installation matchesWORKDIR.0x202alone does not establish the cause; inspect Steam'scontent_log.txt. - Older versions report SteamCMD missing or show blank status fields: synchronize current code and reinstall. Current code corrects user-switching argument handling and tmux pane targeting.
- Configuration directory is not writable: use sudo for the default location, or your own
-cpath.
Shared code is in src/common.bash; src/*.conf contains Chinese and English templates. Generated controllers are standalone and do not need Python or the source tree at runtime.
python3 tools/build.py
python3 tools/build.py --check
bash tests/test.sh
bash tests/test-install.sh
bash tests/test-tmux.shThe first two suites use mocked commands and temporary directories. The last checks real tmux with a private socket and explicitly skips if dependencies are unavailable. None starts a real game or downloads App 730.
Default launch options are based on the original CS2 script and CS:GO script. License: GPL-3.0.