04.07.2013

systemd unit for teeworlds server and extlib

Hi readers!
Some time ago I wrote systemd unit file for teeworlds server. You can use this in Fedora 19 and Fedora Rawhide ( build 0.6.2-2 ).
Later I will send mail to developers with feature request ( configuring game with systemd service file and drop external libs ).

Let's roll!
Files:
systemd service: teeworlds-server@.service
2 example configs: dm.cfg, ctf.cfg
service working in home directory ( /etc/teeworlds/ ) and starts teeworlds server with file.cfg, where "file" - text after "teeworlds-server@".
Simply example. Start, show status and stop teeworlds server with server config from file /etc/teeworlds/dm.cfg :
# systemctl start teeworlds-server@dm $ systemctl status teeworlds-server@dm teeworlds-server@dm.service - Teeworlds server with dm.cfg config file Loaded: loaded (/usr/lib/systemd/system/teeworlds-server@.service; disabled) Active: active (running) since Thu 2013-07-04 09:36:36 MSK; 7s ago Main PID: 17148 (teeworlds-srv) CGroup: name=systemd:/system/teeworlds-server@.service/teeworlds-server@dm.service └─17148 /usr/bin/teeworlds-srv -f dm.cfg Jul 04 09:36:36 brain-Desktop.localdomain teeworlds-srv[17148]: [51d509e4][datafile]: loading done. datafile='maps/dm1.map' Jul 04 09:36:36 brain-Desktop.localdomain teeworlds-srv[17148]: [51d509e4][server]: maps/dm1.map crc is f2159e6e Jul 04 09:36:36 brain-Desktop.localdomain teeworlds-srv[17148]: [51d509e4][server]: server name is 'Fedora DM default server' Jul 04 09:36:36 brain-Desktop.localdomain teeworlds-srv[17148]: [51d509e4][datafile]: loading data index=17 size=325 uncompressed=12000 Jul 04 09:36:36 brain-Desktop.localdomain teeworlds-srv[17148]: [51d509e4][server]: version 0.6 626fce9a778df4d4 Jul 04 09:36:36 brain-Desktop.localdomain teeworlds-srv[17148]: [51d509e4][engine/mastersrv]: refreshing master server addresses Jul 04 09:36:36 brain-Desktop.localdomain teeworlds-srv[17148]: [51d509e4][register]: refreshing ip addresses Jul 04 09:36:37 brain-Desktop.localdomain teeworlds-srv[17148]: [51d509e5][engine/mastersrv]: saving addresses Jul 04 09:36:37 brain-Desktop.localdomain teeworlds-srv[17148]: [51d509e5][register]: fetching server counts Jul 04 09:36:40 brain-Desktop.localdomain teeworlds-srv[17148]: [51d509e8][register]: chose 'master3.teeworlds.com' as master, sending heartbeats # systemctl stop teeworlds-server@dm # systemctl status teeworlds-server@dm teeworlds-server@dm.service - Teeworlds server with dm.cfg config file Loaded: loaded (/usr/lib/systemd/system/teeworlds-server@.service; disabled) Active: inactive (dead) since Thu 2013-07-04 09:37:55 MSK; 5s ago Process: 17148 ExecStart=/usr/bin/teeworlds-srv -f %i.cfg (code=killed, signal=TERM) ... Jul 04 09:37:55 brain-Desktop.localdomain systemd[1]: Stopping Teeworlds server with dm.cfg config file... Jul 04 09:37:55 brain-Desktop.localdomain systemd[1]: Stopped Teeworlds server with dm.cfg config file. $
Do the same with /etc/teeworlds/ctf.cfg :
# systemctl start teeworlds-server@ctf $ systemctl status teeworlds-server@ctf teeworlds-server@ctf.service - Teeworlds server with ctf.cfg config file Loaded: loaded (/usr/lib/systemd/system/teeworlds-server@.service; disabled) Active: active (running) since Thu 2013-07-04 09:38:48 MSK; 3s ago Main PID: 17264 (teeworlds-srv) CGroup: name=systemd:/system/teeworlds-server@.service/teeworlds-server@ctf.service └─17264 /usr/bin/teeworlds-srv -f ctf.cfg Jul 04 09:38:48 brain-Desktop.localdomain teeworlds-srv[17264]: [51d50a68][datafile]: loading done. datafile='maps/ctf1.map' Jul 04 09:38:48 brain-Desktop.localdomain teeworlds-srv[17264]: [51d50a68][server]: maps/ctf1.map crc is 06b5f117 Jul 04 09:38:48 brain-Desktop.localdomain teeworlds-srv[17264]: [51d50a68][server]: server name is 'Fedora CTF default server' Jul 04 09:38:48 brain-Desktop.localdomain teeworlds-srv[17264]: [51d50a68][datafile]: loading data index=10 size=327 uncompressed=14000 Jul 04 09:38:48 brain-Desktop.localdomain teeworlds-srv[17264]: [51d50a68][server]: version 0.6 626fce9a778df4d4 Jul 04 09:38:48 brain-Desktop.localdomain teeworlds-srv[17264]: [51d50a68][engine/mastersrv]: refreshing master server addresses Jul 04 09:38:48 brain-Desktop.localdomain teeworlds-srv[17264]: [51d50a68][register]: refreshing ip addresses Jul 04 09:38:48 brain-Desktop.localdomain teeworlds-srv[17264]: [51d50a68][engine/mastersrv]: saving addresses Jul 04 09:38:48 brain-Desktop.localdomain teeworlds-srv[17264]: [51d50a68][register]: fetching server counts Jul 04 09:38:51 brain-Desktop.localdomain teeworlds-srv[17264]: [51d50a6b][register]: chose 'master3.teeworlds.com' as master, sending heartbeats # systemctl stop teeworlds-server@ctf # systemctl status teeworlds-server@ctf teeworlds-server@ctf.service - Teeworlds server with ctf.cfg config file Loaded: loaded (/usr/lib/systemd/system/teeworlds-server@.service; disabled) Active: inactive (dead) since Thu 2013-07-04 09:44:25 MSK; 1s ago Process: 17264 ExecStart=/usr/bin/teeworlds-srv -f %i.cfg (code=killed, signal=TERM) ... Jul 04 09:44:25 brain-Desktop.localdomain systemd[1]: Stopping Teeworlds server with ctf.cfg config file... Jul 04 09:44:25 brain-Desktop.localdomain systemd[1]: Stopped Teeworlds server with ctf.cfg config file. $
You can see this service file in Fedora works good for multiple server configurations =)
I will inform developers about our progress in future and please, do not use the external libraries anymore. Patch.
Many thanks to Jon Ciesla for sponsoring me in Fedora developers and a great help.

1 комментарий:

utahnaebarb комментирует...

Blackjack: Blackjack: Casinos and tables of life at the
Blackjack is a variant 이천 출장안마 of blackjack played in casinos, 사천 출장마사지 especially in brick-and-mortar 시흥 출장샵 locations such as New Orleans. Players can learn where to 부산광역 출장샵 play 영주 출장샵 blackjack.