Author Topic: Server Start Script  (Read 3997 times)

systemkiller

  • Posts: 1
  • Turrets: +0/-0
Server Start Script
« on: July 26, 2007, 11:01:40 am »
Hi,
my problem is, i had only putty to connect to my server
i can start tremulous server with it but when i left putty the server goes offline,
does somebody had a server start script and can post here?

Thanks,
Systemkiller

tuple

  • Posts: 833
  • Turrets: +97/-80
Server Start Script
« Reply #1 on: July 26, 2007, 12:00:57 pm »
use screen to run it.

CTRL + a + d
to detach a screen.   You can then exit and screen will keep running.

screen -r pid
to reattach later when you reconnect.

edit: Of course, you could use this
It will need to be modified to work for you.  This version worked for me once, though I'm sure my present version looks pre  No console access here though, which frankly is something I've found to be almost entirely worthless.  I use XQF for any kind of rcon stuff I need to do, which may be a lot when you put up a new server.

In case that old thing is FUBAR, here is the one I've been using:

Code: [Select]
#! /bin/sh
set -e

# If you look, you'll see how this is screwed up
BASEPATH="/usr/local/tremulous/.tremulous"
BINPATH="/usr/local/games/tremulous"
# This is the sum total of what I've done to run trem chrooted
# Impressive, isn't it :-P
CHROOTDIR="/usr/local/tremulous"
BINARY="tremded.x86"
DAEMON="$BINPATH/$BINARY"
OPTIONS="+set dedicated 2 +set fs_game base +exec server.cfg"
RUNAS="tremulous:tremulous"
PIDFILE="$BASEPATH/$BINARY.pid"

test -x $DAEMON || exit 0

#export HOME=$BASEPATH
export HOME=/usr/local/tremulous

case "$1" in
start)
echo -n "Starting Tremulous Server"
cd $BASEPATH
start-stop-daemon --start --quiet -c $RUNAS --pidfile $PIDFILE \
-N -2 -m -b -d $BASEPATH --exec $DAEMON -- $OPTIONS
echo "."
;;
stop)
echo -n "Stopping Tremulous Server"
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--exec $DAEMON
echo "."
;;
restart|force-reload)
echo -n "Cycling Tremulous Server - "
$0 stop
sleep 3
$0 start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac

exit 0


change BINPATH, BASEPATH, HOME to represent your directory setup.  Change the RUNAS to reflect the user:group you want it to run as.  change OPTIONS to your server options, though the OPTIONS will work just find for %90 to %95 of people I'd think.

Last but not least, thank Tuple like crazy so that he forgets how crappy this script looks and prevents him from descending into depression while realizing how easy this script would be to fix, and how interminably lazy he is to not bother. :P

let the criticism begin! :-D

This init script originally copied from here

[Kcorp]Noobius

  • Posts: 197
  • Turrets: +3/-4
Server Start Script
« Reply #2 on: July 26, 2007, 01:34:56 pm »
<noob_idea>
erm... wouldn't adding an & at the end just do it? (i dont rly use ssh that much)
</noob_idea>
It's actualy Noobius but i can't be bothered to change it ^^

Quick, name two famous female inventors. Too tough? Ok, just name one.

next_ghost

  • Posts: 892
  • Turrets: +3/-6
Server Start Script
« Reply #3 on: July 26, 2007, 03:39:36 pm »
Quote from: "[Kcorp
Noobius"]<noob_idea>
erm... wouldn't adding an & at the end just do it? (i dont rly use ssh that much)
</noob_idea>


No. Running `program &` leaves the program attached to your bash session as a child and when you quit the session, all children will get SIGHUP and quit (unless they ignore SIGHUP which Tremulous alone does not).
If my answer to your problem doesn't seem helpful, it means I won't help you until you show some effort to fix your problem yourself!
1.2.0 release's been delayed for 5:48:00 already because of stupid questions.

David

  • Spam Killer
  • *
  • Posts: 3543
  • Turrets: +249/-273
Server Start Script
« Reply #4 on: July 26, 2007, 04:31:11 pm »
doing (trem command&)& will fully dissociate the command so it still runs when you log off, however leaves you with no way to access the server via ssh.

What I do is 'screen -R trem' which opens/creates a screen called trem.  just run it each time you want to start / edit the server.
Any maps not in the MG repo?  Email me or come to irc.freenode.net/#mg.
--
My words are mine and mine alone.  I can't speak for anyone else, and there is no one who can speak for me.  If I ever make a post that gives the opinions or positions of other users or groups, then they will be clearly labeled as such.
I'm disappointed that people's past actions have forced me to state what should be obvious.
I am not a dev.  Nothing I say counts for anything.