Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Mar 28, 2014 8:59 pm 
Offline
Senior Newbie

Joined: Fri Aug 09, 2013 2:45 pm
Posts: 9
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 <PID>'

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

Quote:
#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)
Quote:
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).

Quote:
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.


Top
   
PostPosted: Fri Mar 28, 2014 9:20 pm 
Offline
Senior Member

Joined: Sat Nov 27, 2010 8:21 pm
Posts: 63
I expect the command is running before the network comes up. Try adding a sleep in there and see if it helps.


Top
   
PostPosted: Fri Mar 28, 2014 9:26 pm 
Offline
Senior Newbie

Joined: Fri Aug 09, 2013 2:45 pm
Posts: 9
Is there a way to add sleep to the entire cron execution or is it done per line entry ?


Top
   
PostPosted: Fri Mar 28, 2014 9:49 pm 
Offline
Senior Newbie

Joined: Fri Aug 09, 2013 2:45 pm
Posts: 9
Would changing a runlevel of cron from 2 to 3 be a bad idea?

Quote:
chkconfig --list | grep cron
cron 0:off 1:off 2:on 3:on 4:on 5:on 6:off


Quote:
chkconfig --list | grep network
networking 0:off 1:off 2:off 3:off 4:off 5:off 6:off S:on


Top
   
PostPosted: Sat Mar 29, 2014 12:27 am 
Offline
Senior Newbie

Joined: Fri Aug 09, 2013 2:45 pm
Posts: 9
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.

Quote:
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.

Quote:
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 logfile_name tourney3-console.log +set logfile 3 +set logfile_filterlevel 4096 > /dev/null 2>&1 &'


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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group