Changeset 9


Ignore:
Timestamp:
May 15, 2014, 8:38:37 PM (11 years ago)
Author:
alloc
Message:

Fix #1, #2, #3, #5; Refs #4, #6: WD works for save path, not for some logs

Location:
scripts
Files:
3 added
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • scripts/etc/7dtd.conf

    r1 r9  
    88# Root directory of the engine
    99export SDTD_ROOT=/home/sdtd/7dtd
    10 export SDTD_SERVERCONFIG=$SDTD_ROOT/../serverconfig.xml
     10
     11# Root of the 7dtd folders, containing e.g. the "instances" folder
     12export SDTD_BASE=/home/sdtd
    1113
    1214# Root directory for backups
     
    1618export SDTD_USER=sdtd
    1719export SDTD_GROUP=sdtd
    18 
    19 # World to load
    20 export SDTD_WORLD=Navezgane
    21 
    22 # Name of savegame to load
    23 export SDTD_SAVE=a7
    24 
    25 # Base port to use for networking
    26 # Note that baseport (UDP) and base+1 up to base+3 (each TCP) will be used
    27 export SDTD_PORT=25000
    28 
    29 # Set this to a reasonable value to get notified if the engine uses up too much RAM
    30 # Value in mebibytes (MiB)
    31 # For a server only used for 7dtd this should be ~500 MiB lower than the machines total RAM
    32 export MEM_NOTIFY_MAX_RAM=2500
    33 
    34 # If limit exceeded notify someone by email?
    35 export MEM_NOTIFY_MAIL=no
    36 
    37 # If limit exceeded notify someone by XMPP (aka Jabber)?
    38 export MEM_NOTIFY_XMPP=yes
    39 
    40 # XMPP user to use for sending
    41 export XMPP_USER=
    42 # XMPP server for sending
    43 export XMPP_SERVER=
    44 # XMPP account password
    45 export XMPP_PASSWORD=
    46 # Receiver of message
    47 export XMPP_TARGET=
    48 
    49 # Mail from field
    50 export MAIL_FROM=
    51 # Mail receiver
    52 export MAIL_TO=
    53 # Subject of mail
    54 export MAIL_SUBJECT=7dtd memory usage
    55 # SMTP server to use for sending
    56 export MAIL_SMTP=
    57 # SMTP user (not used if empty)
    58 export MAIL_USER=
    59 # SMTP password (not used if empty)
    60 export MAIL_PASS=
    6120
    6221# Paths to binaries. Use "which BINARYNAME" to find the path of a single binary
     
    6827export PIDOF=/bin/pidof
    6928export WINE=/usr/bin/wine
    70 
    71 if [ -e $SDTD_SERVERCONFIG ]; then
    72         export SDTD_TELNET_ENABLED=`xmllint --xpath "string(/ServerSettings/property[@name='TelnetEnabled']/@value)" $SDTD_SERVERCONFIG`
    73         export SDTD_TELNET_PORT=`xmllint --xpath "string(/ServerSettings/property[@name='TelnetPort']/@value)" $SDTD_SERVERCONFIG`
    74         export SDTD_TELNET_PASSWORD=`xmllint --xpath "string(/ServerSettings/property[@name='TelnetPassword']/@value)" $SDTD_SERVERCONFIG`
    75 fi
  • scripts/etc/init.d/7dtd.sh

    r7 r9  
    1313### END INIT INFO
    1414
    15 . /etc/7dtd.conf
    16 
    17 NAME="7DtD"
    18 BINARYPATH=$SDTD_ROOT
    19 USER=$SDTD_USER
    20 RUNTIME=$WINE
    21 BINARYNAME=7DaysToDie.exe
    22 PIDFILE="7dtd-server.pid"
    23 
    24 OPTS="-quit -batchmode -nographics -configfile=../serverconfig.xml -dedicated"
    25 
    26 cd "$BINARYPATH"
     15. /usr/local/bin/7dtd-common.sh
     16checkRootLoadConf
    2717
    2818case "$1" in
    2919    start)
    30         echo -n "Starting the $NAME server... "
    31         if [ ! `pgrep Xvfb` ]; then
    32                 su -c "/usr/bin/Xvfb :1 -screen 0 640x480x16" sdtd &
    33                 sleep 3
    34         fi
    35         if [ -e "$BINARYNAME" ]; then
    36             if [ `pgrep $BINARYNAME` ]; then
    37                 echo "Already running!"
    38             else
    39                 export DISPLAY=localhost:1.0
    40                 start-stop-daemon --start --pidfile $SDTD_ROOT/$PIDFILE --background --no-close --make-pidfile --chuid $USER --user $USER --chdir $BINARYPATH --exec  -- -D -m -S $SCREENREF $RUNTIME $BINARYPATH/$BINARYNAME $OPTS
    41                 sleep 1
    42             fi
    43         else
    44             echo "Could not find binary, aborting!"
    45             exit 5
    46         fi
    47         if [ `pgrep -F $SDTD_ROOT/$PIDFILE` ]; then
    48             echo "Done!"
    49         else
    50             echo "Failed!"
    51             rm -f $SDTD_ROOT/$PIDFILE
    52         fi
     20        echo "Starting all 7dtd instances:"
     21        for I in $SDTD_BASE/instances/*; do
     22            ins=`basename $I`
     23            echo "Starting: $ins"
     24            /usr/local/bin/7dtd-start.sh $ins
     25        done
     26        echo "All done"
    5327    ;;
    5428    stop)
    55         start-stop-daemon --status --pidfile $SDTD_ROOT/$PIDFILE
    56         if [ $? -eq 0 ]; then
    57             echo -n "Stopping the $NAME server... "
    58             if [ "$SDTD_TELNET_ENABLED" = "true" ] && [ -n "$SDTD_TELNET_PASSWORD" ]; then
    59                 echo "$SDTD_TELNET_PASSWORD\nshutdown" | nc -q 2 127.0.0.1 $SDTD_TELNET_PORT
    60                 sleep 5
    61             else
    62                 echo "Telnet not enabled or no password set. No graceful shutdown!"
    63             fi
    64             start-stop-daemon --stop --pidfile $SDTD_ROOT/$PIDFILE
    65             rm $SDTD_ROOT/$PIDFILE
    66             echo "Done!"
    67         else
    68             echo "$NAME not running"
    69         fi
     29        echo "Stopping all 7dtd instances:"
     30        for I in $SDTD_BASE/instances/*; do
     31            ins=`basename $I`
     32            echo "Stopping: $ins"
     33            /usr/local/bin/7dtd-kill.sh $ins
     34            echo
     35            echo
     36        done
     37        echo "All done"
    7038    ;;
    7139    status)
    72         start-stop-daemon --status --pidfile $SDTD_ROOT/$PIDFILE
    73         if [ $? -eq 0 ]; then
    74             echo "$NAME server is running"
    75         else
    76             echo "$NAME server not running"
    77         fi
     40        /usr/local/bin/7dtd-instances.sh
    7841    ;;
    7942    *)
  • scripts/usr/local/bin/7dtd-backup.sh

    r1 r9  
    1818fi
    1919
    20 $RSYNC -a --delete --numeric-ids --delete-excluded $SDTD_ROOT/Data/Worlds/./ $NewBackup
     20$RSYNC -a --delete --numeric-ids --delete-excluded $SDTD_BASE/instances/./ $NewBackup
    2121touch $NewBackup
    2222
  • scripts/usr/local/bin/7dtd-kill.sh

    r1 r9  
    11#!/bin/bash
    2 /etc/init.d/7dtd.sh stop
     2# Tries to stop the 7dtd instance given as first parameter.
     3# Returns:
     4#  0 : Done
     5#  1 : Was not running
     6#  2 : No instance name given
     7#  3 : No such instance
     8
     9. /usr/local/bin/7dtd-common.sh
     10checkRootLoadConf
     11
     12checkInstance $1
     13
     14res=$(isRunning $1)
     15if [ $res -eq 1 ]; then
     16        telnetCommand shutdown
     17        start-stop-daemon --stop --pidfile $(getInstancePath $1)/7dtd.pid
     18        rm $(getInstancePath $1)/7dtd.pid
     19        echo "Done"     
     20        exit 0
     21else
     22        echo "7dtd instance $1 is NOT running"
     23        exit 1
     24fi
  • scripts/usr/local/bin/7dtd-start.sh

    r1 r9  
    11#!/bin/bash
    2 /etc/init.d/7dtd.sh start
     2# Tries to start the 7dtd instance given as first parameter.
     3# Returns:
     4#  0 : Done
     5#  1 : Was already running
     6#  2 : No instance name given
     7#  3 : No such instance
     8#  5 : Unknown error when starting engine
     9
     10. /usr/local/bin/7dtd-common.sh
     11checkRootLoadConf
     12
     13checkInstance $1
     14
     15res=$(isRunning $1)
     16if [ $res -eq 0 ]; then
     17        if [ ! `pgrep Xvfb` ]; then
     18                echo "Xvfb not yet running. Starting..."
     19                su -c "/usr/bin/Xvfb :1 -screen 0 640x480x16" $SDTD_USER &> /dev/null &
     20                sleep 3
     21        fi
     22        export DISPLAY=localhost:1.0
     23       
     24        SSD_PID="--pidfile $(getInstancePath $1)/7dtd.pid --make-pidfile"
     25        SSD_DAEMON="--background --no-close"
     26        SSD_USER="--chuid $SDTD_USER:$SDTD_GROUP --user $SDTD_USER"
     27        OPTS="-quit -batchmode -nographics -configfile=$(getInstancePath $1)/serverconfig.xml -dedicated"
     28       
     29        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
     30        sleep 1
     31        res=$(isRunning $1)
     32        if [ $res -eq 1 ]; then
     33                echo "Done!"
     34                exit 0
     35        else
     36                echo "Failed!"
     37                rm -f $(getInstancePath $1)/7dtd.pid
     38                exit 5
     39        fi
     40else
     41        echo "7dtd instance $1 is already running"
     42        exit 1
     43fi
  • scripts/usr/local/bin/7dtd-update.sh

    r1 r9  
    11#!/bin/bash
    2 . /etc/7dtd.conf
     2. /usr/local/bin/7dtd-common.sh
     3checkRootLoadConf
     4
     5for I in $SDTD_BASE/instances/*; do
     6        ins=`basename $I`
     7        run=$(isRunning $ins)
     8        if [ $run -eq 1 ]; then
     9                echo "At least one instance is still running."
     10                echo "Before updating the engine please stop all instances!"
     11                exit 1
     12        fi
     13done
    314
    415if [ ! -e $STEAMCMD_ROOT ]; then
     
    1324cd $STEAMCMD_ROOT
    1425
    15 ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login $STEAM_USER $STEAM_PASS +force_install_dir $SDTD_ROOT +app_update 251570 validate +quit
     26./steamcmd.sh +@sSteamCmdForcePlatformType windows +login $STEAM_USER $STEAM_PASS +force_install_dir $SDTD_ROOT "+app_update 251570" validate +quit
    1627chown $SDTD_USER.$SDTD_GROUP -R $SDTD_ROOT
    1728
     
    1930cp $SDTD_ROOT/Install/32bit/mono.dll $SDTD_ROOT/7DaysToDie_Data/Mono/
    2031cp $SDTD_ROOT/Install/32bit/SteamworksManaged.dll $SDTD_ROOT/7DaysToDie_Data/Managed/
    21 cp $SDTD_ROOT/../msvcr100.dll $SDTD_ROOT/
     32cp $SDTD_BASE/msvcr100.dll $SDTD_ROOT/
Note: See TracChangeset for help on using the changeset viewer.