ashusk tmp quake4-142 cat start bin bash cd dirname dir pwd name basen

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
ashusk:/tmp/quake4-142# cat ./start
#!/bin/bash
cd `dirname $0`
dir=`pwd`
name=`basename $dir`
if [ -f "./game.pid" ]
then
PID=`cat ./game.pid`
VALUE=`ps ax -opid | grep $PID | wc -l`
if [[ $VALUE > 0 ]]
then
echo "Already running"
exit 1
fi
fi
PORT=$1
MAXPLAYERS=$2
LAUNCH=$3
rm -rf ./game.pipe
mkfifo ./game.pipe
screen -AmdS $name ./substart $1 $2 "$3" &
#echo " ">./game.pipe
sleep 3
ashusk:/tmp/quake4-142# cat ./substart
#!/bin/bash
./q4ded.x86 +set net_port $1 set fs_basepath "." +set fs_savepath "./srv/q4srv1" +set fs_game q4max +exec q4server.cfg $3 >/dev/null 2>/dev/null &
echo $! > ./game.pid