Teeworlds formally known as Teewars is a side scrolling first person shooter. A better description of the game can be found Here. I was sick and tired of not having an init script for the Teeworlds server so I ended up creating one. With the init script Teeworlds can be started/stoped/restarted using just a single command. The best part of having an init script is the ability to automagically startup Teeworlds during server server start.
Question and Answer
Q: Why create an init script?
A: Init scripts are small shell programs that usually control services, also known as daemons. This being said all administrators want a single point of access to control a daemon/service on their linux hosts. Creating an init script for Teeworlds gives you that control.
Q: Why not run the server as root?
A: Well first of all running most services as root including games is a rather silly and dangerous idea unless it can't be avoided. All it takes is a published exploit of the running service and commands can be executed on your box as the root user. While this is handy to hackers/crackers this is not very desirable for system administrators.
Teeworlds Installation Instructions
Make required directories
mkdir -p /opt/games/teewars/config/;
mkdir -p /var/run/teewars/;
Grap Teeworlds Linux Binary (x86)
wget http://www.teeworlds.com/files/teeworlds-0.4.1-linux_x86.tar.gz;
tar –xzvf teeworlds-0.4.1-linux_x86.tar.gz -C /opt/games/teewars/;
Grap Teewars Config
wget http://www.dynamicpulse.com/system/files/teewars_srv.cfg -c -o /opt/games/teewars/config/teewars_srv.cfg;
chmod 750 /opt/games/teewars/config/teewars_srv.cfg;
Note: Take time to modify the teewars_srv.cfg file with your editor of choice (vi/vim/nano…). Replace the < SERVER NAME > / < REMOTE CONTROL PASSWORD > with custom values. Keep in mind this is only meant to be a template. There are a many additional items that can be added/removed from this configuration.
Grap Teewars Init Script
wget http://www.dynamicpulse.com/system/files/teewars_init -c -o /etc/init.d/teewars_init;
chown root:root /etc/init.d/teewars_init;
chmod 550 /etc/init.d/teewars_init;
Create Group and User Account
groupadd -g 1004 games;
useradd -d /opt/games/teewars -g 1004 -u 1009 -c "Teewars Server" teewars;
Permission Files and Folders
chown -R teewars:games /opt/games/teewars;
chown -R teewars:games /var/run/teewars;
Init Script Commands
Launch Game Server
/etc/init.d/teewars_init start
Shutdown Game Server
/etc/init.d/teewars_init stop
Restart Game Server
/etc/init.d/teewars_init restart
| Attachment | Size |
|---|---|
| teewars_srv.cfg | 322 bytes |
| teewars_init | 1001 bytes |