1
|
1 #!/bin/sh
|
|
2 #
|
|
3 # Server startup script for NetrekII (Paradise)
|
|
4 #
|
|
5 # If args1 exists it is assumed it is NETREKDIR, and will be used
|
|
6 # in place of whatever NETREKDIR was before. If NETREKDIR is not
|
|
7 # found it will attempt to find it in ../etc/conf.netrekdir
|
|
8 #
|
|
9
|
|
10 if [ X$1 != X ]; then
|
|
11 NETREKDIR=$1
|
|
12 elif [ X${NETREKDIR} = X ]; then
|
|
13 if [ -f "../etc/conf.netrekdir" ]; then
|
|
14 NETREKDIR=`cat "../etc/conf.netrekdir"`
|
|
15 else
|
|
16 echo "No NETREKDIR variable found, exiting."
|
|
17 exit 1
|
|
18 fi
|
|
19 fi
|
|
20
|
|
21 PORT=2592
|
|
22 PLPORT=2591
|
|
23 LOGS="${NETREKDIR}/logs"
|
|
24
|
|
25 if [ ! -f "${NETREKDIR}/bin/listen" ]; then
|
|
26 echo "$0: ${NETREKDIR}/bin/listen not found, exiting."
|
|
27 exit 1
|
|
28 fi
|
|
29
|
|
30 if [ -f "${LOGS}/server.log" ]; then
|
|
31 echo "$0: Moving server logfile to server.log.old"
|
|
32 mv ${LOGS}/server.log ${LOGS}/server.log.old
|
|
33 fi
|
|
34
|
|
35 if [ -f ${LOGS}/startup.log ]; then
|
|
36 echo "$0: Moving startup.log to startup.log.old"
|
|
37 mv ${LOGS}/startup.log ${LOGS}/startup.log.old
|
|
38 fi
|
|
39
|
|
40 echo "Netrek Server Startup at `date` by ${USER}" >> "${LOGS}/startup.log"
|
|
41 echo "NETREKDIR=${NETREKDIR}" >> "${LOGS}/startup.log"
|
|
42 echo "PORT=${PORT}" >> "${LOGS}/startup.log"
|
|
43 echo "PLPORT=${PLPORT}" >> "${LOGS}/startup.log"
|
|
44
|
|
45 # Startup listen
|
|
46 ${NETREKDIR}/bin/listen -p ${PLPORT}
|
|
47 ${NETREKDIR}/bin/listen -p ${PORT}
|
|
48
|
|
49 # Startup the connected players port
|
|
50 if [ -f ${NETREKDIR}/faucet -a -f ${NETREKDIR}/pl ]; then
|
|
51 echo "$0: Starting player listing on port ${PLPORT}" >> ${LOGS}/startup.log
|
|
52 ${NETREKDIR}/faucet ${PLPORT} -out pl &
|
|
53 fi
|