fix a few memory leaks and cppcheck detected errors - more in bugreport
[client-tools.git] / exe / linux / designserver
blob967f31ca905ccfe5b753781320a2d6ce56b7b584
1 #!/bin/bash
3 CLUSTER_NAME=DesignGalaxy
4 CENTRAL_SERVER_ADDRESS=swo-dev7.station.sony.com
5 CENTRAL_GAME_PORT=44471
6 CENTRAL_PLANET_PORT=44475
7 GAME_SCENE=naboo.trn
8 PLANET_NAME=$USER
9 LOGIN_SERVER_ADDRESS=swo-dev6.station.sony.com
10 EXE_DIR=~/swg/current/exe/linux
12 get_free_port()
14 PORT=(RANDOM + 1024)
15 ((PORT=$PORT+1))
16 AVAIL=`netstat -aut|grep $PORT`
17 while [ -n "$AVAIL" ];
20 ((PORT=RANDOM))
21 AVAIL=`netstat -aut|grep $PORT`
23 done
24 echo $PORT
27 run_gameserver()
29 cd $EXE_DIR
31 echo "** Starting GameServer at " $(date +"%Y%m%d-%k.%M.%S")
32 ./SwgGameServer_d -- @servercommon.cfg @combat.cfg \
33 -s GameServer sceneID=$PLANET_NAME \
34 centralServerAddress=$CENTRAL_SERVER_ADDRESS \
35 centralServerPort=$CENTRAL_GAME_PORT \
36 groundScene=terrain/${GAME_SCENE} \
37 clusterName=$CLUSTER_NAME \
38 useTemplates=1 \
39 regenerationRate=0.00532 \
40 scriptPath=../../data/sku.0/sys.server/compiled/game \
41 useRemoteDebugJava=0 \
42 javaDebugPort=0 \
43 javaConsoleDebugMessages=1\
44 -s SharedFoundation \
45 frameRateLimit=4 \
46 warningCallStackDepth=0 \
47 -s SharedDebug \
48 lookupCallStack=1 &
51 run_planetserver()
53 GAME_SERVICE_PORT=(get_free_port);
54 cd $EXE_DIR
55 echo "** Starting PlanetServer at " $(date +"%Y%m%d-%k.%M.%S") " gameserviceport=${GAME_SERVICE_PORT}"
56 ./PlanetServer_d -- \
57 -s PlanetServer sceneID=$PLANET_NAME \
58 clusterName=$CLUSTER_NAME \
59 centralServerAddress=$CENTRAL_SERVER_ADDRESS \
60 centralServerPort=$CENTRAL_PLANET_PORT \
61 gameServicePort=0 &
64 fatality()
66 CRASHDIR="/swo/swg/CRASH-"`date +"%Y%m%d-%k.%M.%S"`
67 echo ""
68 echo "**********************************************************************"
69 echo "** !!FATAL WARNING FATAL WARNING FATAL WARNING FATAL WARNING!!"
70 echo "**"
71 echo "** $1 "
72 echo "**"
73 echo "** Server is no longer running. It failed to properly start."
74 echo "** If this is an unknown bug, advise the server development team."
75 echo "**"
76 echo "** A crash directory called $CRASHDIR"
77 echo "** is being created, logs and the core file will be placed in "
78 echo "** $CRASHDIR"
79 echo "**"
80 echo "**********************************************************************"
81 echo ""
82 echo -n "Killing servers ..."
83 mkdir $CRASHDIR
84 cp /swo/swg/*.log $CRASHDIR
85 cp /swo/swg/current/exe/linux/core $CRASHDIR
86 kill_servers
87 echo "done."
91 #-----------------------------------------
92 #-- parse options
93 #-----------------------------------------
95 show_usage ()
98 echo "Options:"
99 echo " -h help"
100 echo " -s <scene> scenefile (default: $GAME_SCENE)"
101 echo " -x <exe dir> executable dir name (default: $EXE_DIR)"
102 echo " -n <nbname> nbname dir (default: $NBNAME)"
103 echo " -p <planetname> planet name (default: $PLANET_NAME)"
106 while getopts "hs:x:n:p:" arg
108 case $arg in
109 "s")
110 GAME_SCENE=$OPTARG
111 echo "Setting Game Scene to: $GAME_SCENE"
113 "x")
114 EXE_DIR=$OPTARG
115 echo "Setting Executable Dir to: $EXE_DIR"
117 "p")
118 PLANET_NAME=$OPTARG
119 echo "Setting Planet Name to: $PLANET_NAME"
121 "h")
122 show_usage;
125 show_usage;
127 esac
128 done
130 #-----------------------------------------
131 #-----------------------------------------
133 echo "Port selection:"
135 echo -n "Starting planet server planet=${PLANET_NAME}... "
136 run_planetserver
137 echo "done."
138 sleep 2
139 echo -n "Starting game server planet=${PLANET_NAME} scene=${GAME_SCENE} ... "
140 run_gameserver
142 echo "done"
143 echo ""
144 echo "**********************************************************************"
145 echo "You may now connect to your game cluster [ $CLUSTER_NAME ]."
146 echo "Your client configuration should have an entry "
147 echo "loginServerAddress=$LOGIN_SERVER_ADDRESS "
148 echo ""
149 echo "If you are connecting to a different login server"
150 echo "ensure that servercommon.cfg in your depot reflects the"
151 echo "alternate server address, and that your client config"
152 echo "matches."
153 echo ""
154 echo "Contact Justin Randall or Chris Mayer if you are having trouble"
155 echo "**********************************************************************"