![]() |
[Info] Fedora / Redhat / CentOS -- FirewallD and SystemD Service Files for dedicated - Printable Version +- Xonotic Forums (https://forums.xonotic.org) +-- Forum: Creating & Contributing (https://forums.xonotic.org/forumdisplay.php?fid=10) +--- Forum: Xonotic - Development (https://forums.xonotic.org/forumdisplay.php?fid=12) +--- Thread: [Info] Fedora / Redhat / CentOS -- FirewallD and SystemD Service Files for dedicated (/showthread.php?tid=8342) |
[Info] Fedora / Redhat / CentOS -- FirewallD and SystemD Service Files for dedicated - TimelesslyPrecise - 06-02-2020 Thread Starter / note for later reference, I noticed at the time of writing, CentOS 8 does not have Xonotic in the EPEL repo yet... Fedora 32 has it. packaged versions are missing a FirewallD and SystemD 'service' files. maybe this can make it's way to mainstream packaging/release.. the following should be sufficient (and would be handy if included in the 'xonotic-dedicated' package in the repo): FirewallD Service (where): Code: /usr/lib/firewalld/services/xonotic-server.xml Contents: Code: <?xml version="1.0" encoding="utf-8"?> Load it up (persistent after reboots & run it now): Code: sudo firewall-cmd --add-service=xonotic-server --permanent ------------- ------------- SystemD Service (where): Code: /usr/lib/systemd/system/xonotic-server.service Contents: Code: ####Xonotic Server SystemD service configuration file Might need to reload systemD and also might need to fix SElinux context for systemd to work with the service (running this as root): Code: restorecon -R -v /usr/lib/systemd/system/ Load it up (persistent after reboots & run it now): Code: sudo systemctl enable --now xonotic-server.service Check the status: Code: sudo systemctl status xonotic-server Manage: Code: sudo systemctl start xonotic-server Turn it off(persistent after reboots): Code: sudo systemctl disable xonotic-server.service With this way, you can load custom maps in ~/.xonotic/data/maps for custom maps to be loaded, and have ~/.xonotic/data/server.cfg in the default locations for the dedicatedxonoticuser you create. tune to your liking. good starting point to get this pushed into the repos. Thanks RE: [Info] Fedora / Redhat / CentOS -- FirewallD and SystemD Service Files for dedicated - BuddyFriendGuy - 06-04-2020 You can always wrap Code: xonotic-dedicated -game data/maps in a script, which will then look at a flag (say the content of a file) to determine whether or not to continue run the command above. And to quit the server, you can just send the quit command to the server via rcon. RE: [Info] Fedora / Redhat / CentOS -- FirewallD and SystemD Service Files for dedicated - TimelesslyPrecise - 06-04-2020 (06-04-2020, 04:44 PM)BuddyFriendGuy Wrote: You can always wrap the systemD seems to handle it okay.. (this is the package manager installed version, so the command is in path) It was also working fine with static xonotic 0.82 downloaded in /usr/games/Xonotic i noticed some funky behaviour missing the last -game arg, so i edited the original post back to this line Code: ExecStart=xonotic-dedicated -game data/maps -game data it seems when you rcon quit, the systemD will restart the server automatically for you. there are delay and other parameters which can be set. this suits my purposes well. and now with the original -gamdir its behaving as intended again. so just issue systemctl stop xonotic-server.service should handle it well. (i'm sure you can set more args to make it not restart the service upon quit, which i don't know off the top of my head) RE: [Info] Fedora / Redhat / CentOS -- FirewallD and SystemD Service Files for dedicated - BuddyFriendGuy - 06-04-2020 I thought by the "softer" approach, you meant controling the service without the root privilege or changing system files. Perhaps I didn't explain it well. The idea is your systemd would call a script like this (pseudo code): Code: #!/usb/bin/bash To prevent systemd from restarting automatically upon quit, change this line in your /usr/lib/systemd/system/xonotic-server.service: Code: #Restart=always Or, you can also use systemd user services. |