Webmin Modular HLDS/SRCDS/TS Server Control Tutorial

This tutorial walks you through how to use webmin to control most aspects of a HLDS, SRCDS or TS server running on that box.
First login to webmin.
- Go to “Webmin Configuration”
- Go to “Edit Categories”
- Down the table there is a section to add your own custom Webmin Section, in the ID box put something like “Game_Servers”
- In the “Displayed Description” box, put something (what you put in there is what will be displayed below the icon in webmin) Ex. “Control Game/VoiP servers”
- Save
Next you want to go to:
- Other Section
- Custom Commands Module
Creation of custom command/file edits now:
- Click on “Create a new custom command”
- In the “description” box, put something like “Start Server”
- The box below is optional, but its good to put something in there for some type of explination. Ex.
Hit this button to start the Server
- In the “command” box, put “sh start.sh”, this is what command is executed when you hit the button
- In the “Run in Directory” put the location of the server, like /home/*user*/
- “Run as User”, you HAVE TO put the shell account user name in that box, or else it will exec the server as root and mess everything up.
- Leave everything else alone except the “Maximum time to wait for command?”, click the dot next to the box and put “30″ in there, for 30 seconds. Almost all commands you want to do this, this will cut off a command if it takes longer than 30 sec, instead of hanging up your browser and causing the process to crash and not finish.
- Hit Save
Repeat for, start/stop,restart commands
Stop
Hit this button to shutdown the server. You must hit the “Start Server” button to start server back up
Restart
Hit this button to restart the server. This kills the screen and execs the start script
Next is to setup a screen command. Do the same thing as the above examples except now:
- In the “command” line, put “screen -wipe” exactly
- Make sure the user and directory is correct, then save
Clear any dead screens and view if a server is running. If there is multiple screens “detached”, then you must kill all screens via the “system”, “running processes” section. Then hit “Start” button for this server
Next is to create a new file editor:
- Hit “Create a new file editor”
- Now you want to create file edits for configs, first the start/stop/restart scripts
- In the “Description” box put:
Edit StartServer Script (server.sh)
- In the box below put something like:
If you wish to edit the startup parameters such as slot size and tickrate
- Then type out the location of the file, ex. /home/*user*/server.sh
Example Start.sh code:
echo �Starting Server�
echo �cd ..�
echo �cd ..�
echo �cd /home/*user*/�
echo �sh start.sh�
screen -A -m -d -S servername /home/*user*/srcds_run -console -cstrike +map de_dust2 +maxplayers 26 -autoupdate -IP xxx.xxx.xxx.xxx -port 27015 +fps_max 200 -tickrate 66
echo �Server Starting��
echo �Parameters srcds_run -console -cstrike +map de_dust2 +maxplayers 26 -autoupdate -IP xxx.xxx.xxx.xxx -port 27015 +fps_max 200 -tickrate 66 ?
echo ��Server Started�
- Save and repeat for Stop:
echo �Stopping Server��
screen -dr servername -X quit
echo � �
echo ��Server Stopped�
- Restart:
echo �Restarting Server��
echo �screen -dr servername -X quit�
screen -dr servername -X quit
echo �Server Stop successful��
echo �cd ..�
echo �cd ..�
echo �cd ..�
echo �cd /home/*user*/�
cd ..
cd ..
cd ..
cd ./home/*user*/
sh server.sh
echo �sh server.sh�
echo ��Server Restart Successful�
Next is to do your update server command:
- Create a custom command
- Same settings but, in the 2nd description box put something like
Server Must be stopped to continue…
Hit this button to update the server, it may take several minutes, do not leave or refresh the page until it is complete.
- Then put your install argument, ex.
./steam -command update -game “counter-strike source” -dir /home/*user*/
- This time, the “maximum time to wait for command?”, leave it at infinte.
Continue on for any config files you have, creating text editors for each, either cfg’s or txt’s or cfg.old it will edit the file. Thats how I keep track of 10 game servers and 3 TS servers, is through Webmin Custom Modules.
Once you finish your “master” custom module, of which you can duplicate many times for multiple servers go to:
- Webmin section
- “Webmin Configuration” module
- “Webmin Modules” module
- You want to “clone module”
- Select “custom commands” as the “module to clone”
- Type in the module name you want (ex. awp server) under “cloned module name”
- In the “assign to category”, select your custom category you made, then “Game/VioP server Control”
- Hit “Clone Module”
Once that is done, you can create a webmin user account, then add that custom module you just created and your ready to go. If you want to give someone almost complete control of a server without FTP or SSH access, you can.
Via the “File manager” in “read only mode” to the specific game directory
Via the “Running Processes” and able to only see and kill thier own processes
Via the “Upload and Download” and only able to see and upload/download files to their own server directory.
This can give someone the same control as FTP or SSH (just a bit slower if you want to upload a lot of files). But this is the way to do it without FTP or SSH access.