Skip to content

Instantly share code, notes, and snippets.

@L1fescape
Last active October 29, 2022 09:46
Show Gist options
  • Save L1fescape/e73a97ada9356e79ffd4 to your computer and use it in GitHub Desktop.
Save L1fescape/e73a97ada9356e79ffd4 to your computer and use it in GitHub Desktop.
A script for installing, updating, and playing steam games on your own dedicated server
log on
hostname "Welcome to L1fescape's CS:GO Server!"
rcon_password "<pass>"
sv_password ""
sv_cheats 0
sv_lan 0
sv_setsteamaccount <workshop_key>
exec banned_user.cfg
mp_autoteambalance 1
mp_limitteams 1
writeid
writeip
#!/bin/bash
alias steamcmd="cd $HOME/steamcmd; ./steamcmd.sh"
api_key=""
function steam () {
local steamapps_root_dir="$HOME/games"
local command="$1"
local game="$2"
case $game in
"gmod")
local game_dir="gmod";
local game_id=4020;
local game_command="-game garrysmod +gamemode prop_hunt +maxplayers 32 +map ph_fancyhouse +host_workshop_collection 177117131 -authkey $api_key";
local run_cmd="srcds_run -debug";
;;
"rust")
local game_dir="rust";
local game_id="258550 -beta legacy validate"
local game_command="-batchmode +server.port 28015 +server.tickrate 128 +server.hostname +server.maxplayers 50 +server.worldsize 4000 +server.saveinterval 600 +rcon.ip 0.0.0.0 +rcon.port 28016 +rcon.password 'overwatch cooldown' -logfile logfilename.log";
local run_cmd="RustDedicated";
;;
"csgo")
local game_dir="cs_go";
local game_id=740;
local default_command="-console -usercon +game_type 0 +game_mode 1 +ip 0.0.0.0 +net_public_adr 0.0.0.0 -port 27015 -tickrate 128 +exec server.cfg";
local comp="+mapgroup mg_bomb +map de_dust2";
local prac="+host_workshop_collection 330128769 +host_workshop_map 243702660 -authkey $api_key";
local game_command="$default_command $prac";
local run_cmd="srcds_run";
;;
"l4d2")
local game_dir="l4d2";
local game_id=222860;
local game_command="+maxplayers 32 +ip 204.27.59.250 +map c4m1_milltown_a +host_workshop_collection 216548698 -authkey $api_key";
local run_cmd="srcds_run";
;;
*)
echo "Provide a valid game id";
return
;;
esac
local install_dir="$steamapps_root_dir/$game_dir"
# create the installation directory if it doesn't exist
[ -d $install_dir ] || mkdir $install_dir
case $command in
"install" | "update")
steamcmd +login anonymous +force_install_dir $install_dir +app_update $game_id +quit
;;
"play")
$install_dir/$run_cmd $game_command
;;
*)
echo "Invalid command";
return
;;
esac
}
@L1fescape
Copy link
Author

Dependencies:

Usage:

$ steam install csgo
$ steam play csgo

Useful Links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment