Thursday, July 24, 2014

Quake II - Amazon Linux Server: Q2R1 init.d Script

About a month ago, I was asked about the current status of my Quake 2 server. Having not checked on it in some time, I check the status and find that it is down.

I start the server again using the command mentioned in this older post, closed the terminal, and thought all was well. The next day I go to check on it again, and it's down. Every time I closed the terminal window, the server stopped. This was not a problem before, and the only thing I can figure is that some recent Amazon Linux security update is now preventing my old command from running in the background. Time to write a proper init.d script.


 I actually had an one laying around I had tried making months back, but couldn't get to work. It only needed a couple of typo fixes. After adding the script to init.d and firing the command quake2-server start, the server continues to run after closing the window and is still running as of this post. Here is a working init.d script for running R1ch's Enhanced Quake 2 server on Amazon Linux as a service:

#!/bin/sh
#
# quake2-server:       Starts the Q2R1 dedicated Quake2 Server
#
# Version:      @(#) /etc/init.d/quake2-server 1
#
# chkconfig: 2345 20 10
# description: Starts and stops the Quake2 Server at boot time and shutdown.
#
# processname: quake2-server


# Source function library.
. /etc/rc.d/init.d/functions

# See how we were called.
case "$1" in
  start)
        printf "Starting Quake2 Server: "
        cd /home/ec2-user/quake2/ && ./r1q2ded +set rcon_password '<PutYourPassFromServerCfgHere>' +set game lit                 hium +exec server.cfg > /dev/null >&1&
        echo
        ;;
  stop)
        printf "Shutting down Quake2 Server: "
        killproc r1q2ded
        rm -f /var/lock/subsys/quake2-server
        echo
        ;;
  status)
        status quake2-server
        ;;
  *)
        printf "*** Usage: quake2-server {start|stop|status}\n"
        exit 1
esac

exit 0


I hope someone else finds a use for this. If you are and would like some assistance or have any suggestions, please leave a comment.

3 comments:

  1. Hi, I have setup a server using r1q2ded binary. I'm not being able to run any mods tho.

    I'm trying to run the Holywars and the OSP Tourney mods.

    - I've tried running r1q2ded +set game "modname".... but it doesn't work.

    - I've also tried running the r1q2ded-old with the same options but my console throws me: "-bash: ./r1q2ded-old: No such file or directory" (The file exists and has execute permissions)

    If you could help me, I would be eternally in debt.

    Cheers

    ReplyDelete
  2. Hello. Sorry for the late reply. It is possible that perhaps the mod itself is not compatible with the r1q2ded binary.

    Are you able to start a "vanilla" quake 2 server OK? Are you using the linux version of the mod? (if one exists).

    I had a request to throw the "jailbreak" mod on mine but was not able to find anything but the windows DLL version of it.

    ReplyDelete