source: scripts/usr/local/bin/7dtd-start.sh@ 11

Last change on this file since 11 was 10, checked in by alloc, 11 years ago

Version 1

  • Property svn:executable set to *
File size: 1.2 KB
RevLine 
[1]1#!/bin/bash
[10]2# Version 1
3
[9]4# Tries to start the 7dtd instance given as first parameter.
5# Returns:
6# 0 : Done
7# 1 : Was already running
8# 2 : No instance name given
9# 3 : No such instance
10# 5 : Unknown error when starting engine
11
12. /usr/local/bin/7dtd-common.sh
13checkRootLoadConf
14
15checkInstance $1
16
17res=$(isRunning $1)
18if [ $res -eq 0 ]; then
19 if [ ! `pgrep Xvfb` ]; then
20 echo "Xvfb not yet running. Starting..."
21 su -c "/usr/bin/Xvfb :1 -screen 0 640x480x16" $SDTD_USER &> /dev/null &
22 sleep 3
23 fi
24 export DISPLAY=localhost:1.0
25
26 SSD_PID="--pidfile $(getInstancePath $1)/7dtd.pid --make-pidfile"
27 SSD_DAEMON="--background --no-close"
28 SSD_USER="--chuid $SDTD_USER:$SDTD_GROUP --user $SDTD_USER"
29 OPTS="-quit -batchmode -nographics -configfile=$(getInstancePath $1)/serverconfig.xml -dedicated"
30
31 start-stop-daemon --start $SSD_PID $SSD_DAEMON $SSD_USER --chdir $SDTD_ROOT --exec $WINE -- $SDTD_ROOT/7DaysToDie.exe $OPTS > $(getInstancePath $1)/stdout.log 2>&1
32 sleep 1
33 res=$(isRunning $1)
34 if [ $res -eq 1 ]; then
35 echo "Done!"
36 exit 0
37 else
38 echo "Failed!"
39 rm -f $(getInstancePath $1)/7dtd.pid
40 exit 5
41 fi
42else
43 echo "7dtd instance $1 is already running"
44 exit 1
45fi
Note: See TracBrowser for help on using the repository browser.