Quake2 Game Server starts but does not listen to an any port

Hello. I am trying to understand why the q2server process starts on reboot, but does not listen to any port.

I checked with 'netstat -anp | grep '

I set it to auto start on reboot with the following cron entry.

> #this below command for q2 doesn't work for some reason. The q2server starts but it doesn't listen to on any port

@reboot /home/ts3/q2server/r1q2ded +set ip 50.116.61.37 +set port 27910 +set dedicated 1 +set game opentdm +exec server.cfg +map q2rdm2 > /dev/null 2>&1 &

With the above entry uncommitted and after the host is rebooted, I immediately see the following process with pid 3664, and ppid 1 (init)
> ps -ef | grep q2

ts3 3664 1 1 20:31 ? 00:00:21 /home/ts3/q2server/r1q2ded +set ip 50.116.61.37 +set port 27910 +set dedicated 1 +set game opentdm +exec server.cfg +map q2rdm2

However, when I copy and paste the command myself, it starts the server and also is listening on specified port 27910. I noticed the difference that the ppid is not 1 (init).

> BASH-ts3@oruvmlnd /home/ts3/q2server# /home/ts3/q2server/r1q2ded +set ip 50.116.61.37 +set port 27910 +set dedicated 1 +set game opentdm +exec server.cfg +map q2rdm2 > /home/ts3/q2server/logs/opentdm-console.log 2>&1 &

[1] 4751

BASH-ts3@oruvmlnd /home/ts3/q2server# ps -ef | grep q2server

ts3 4751 4708 0 20:56 pts/0 00:00:00 /home/ts3/q2server/r1q2ded +set ip 50.116.61.37 +set port 27910 +set dedicated 1 +set game opentdm +exec server.cfg +map q2rdm2

ts3 4753 4708 0 20:57 pts/0 00:00:00 grep q2server

BASH-ts3@oruvmlnd /home/ts3/q2server# netstat -an | grep 27910

tcp 0 0 50.116.61.37:37525 173.236.101.35:27910 ESTABLISHED

udp 0 0 50.116.61.37:27910 0.0.0.0:*

BASH-ts3@oruvmlnd /home/ts3/q2server#

As you can see the server is starting and listening on the right port. But only when i run the command manually, and the ppid is different.

4 Replies

I expect the command is running before the network comes up. Try adding a sleep in there and see if it helps.

Is there a way to add sleep to the entire cron execution or is it done per line entry ?

Would changing a runlevel of cron from 2 to 3 be a bad idea?

> chkconfig –list | grep cron

cron 0:off 1:off 2:on 3:on 4:on 5:on 6:off

> chkconfig –list | grep network

networking 0:off 1:off 2:off 3:off 4:off 5:off 6:off S:on

I got it working using q2server start-up on boot using /etc/init.d/q2-opentdm-tourney3

As you can see in the q2-opentdm-tourney3 script below the start command has –chuid ts3:ts3 which is user:group.

With this in mind q2server runs as the user:group specified, instead of root.

> etc/init.d# cat q2-opentdm-tourney3

! /bin/sh

set -e

start and stop the Quake II servers

test -x /home/ts3/q2server/start-opentdm-tourney3 || exit 0

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in

start)

echo -n "Starting Quake II server: opentdm-tourney3"

start-stop-daemon –start --quiet --chuid ts3:ts3 --chdir /home/ts3/q2server --exec /home/ts3/q2server/start-opentdm-tourney3

echo "."

;;

*)

echo "Usage: /etc/init.d/"q2-opentdm-tourney3" {start}"

exit 1

esac

exit 0

Quake 2 server start command is in a shell script start-opentdm-tourney3 below, which is being called by /etc/init.d/q2-opentdm-tourney3 start.

> cat /home/ts3/q2server/start-opentdm-tourney3

!/bin/sh

nohup sh -c './r1q2ded +set ip 50.116.61.37 +set port 27910 +set dedicated 1 +set game opentdm +exec server.cfg +map q2rdm2 +set logfilename tourney3-console.log +set logfile 3 +set logfilefilterlevel 4096 > /dev/null 2>&1 &'

So as a result, q2server starts when I reboot the server and it works as expected.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct