Changeset 87


Ignore:
Timestamp:
Jul 19, 2014, 1:53:35 PM (10 years ago)
Author:
alloc
Message:

v.32

Location:
scripts/usr/local/lib/7dtd
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • scripts/usr/local/lib/7dtd/VERSION

    r80 r87  
    1 Version: 31
    2 Release: 2014-07-17
     1Version: 32
     2Release: 2014-07-19
     3DediBuild: 320404
     4
  • scripts/usr/local/lib/7dtd/commands/updateengine.sh

    r80 r87  
    4242        local LOCAL=$(getLocalEngineVersion)
    4343        local REMOTE=$(getRemoteEngineVersion)
     44        local LOCAL_SUPPORTED_BUILD=$(cat /usr/local/lib/7dtd/VERSION | grep "DediBuild" | cut -d\  -f2)
    4445
    4546        if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then
     
    4849                echo "Available buildid: $REMOTE"
    4950                echo
    50                
     51
     52                if [ "$LOCAL_SUPPORTED_BUILD" != "$REMOTE" ]; then
     53                        echo "WARNING!!! The currently installed version of the scripts do not support the newer dedicated server build!"
     54                        echo "If you continue you might not be able to start the server."
     55                        echo "Please wait for an updated release of the scripts or continue at your own risk."
     56                        echo
     57                fi
     58       
    5159                while : ; do
    5260                        local CONTINUE
     
    7078
    7179                cp $SDTD_BASE/linux_files/engine/* $SDTD_BASE/engine/ -R
     80                cp /usr/local/lib/7dtd/server-fixes/* $SDTD_BASE/engine/7DaysToDie_Data/Managed/
    7281                cp $SDTD_BASE/engine/Install/32bit/SteamworksManaged.dll $SDTD_BASE/engine/7DaysToDie_Data/Managed/
    7382
    7483                chown $SDTD_USER.$SDTD_GROUP -R $SDTD_BASE/engine
     84
     85                if [ "$LOCAL_SUPPORTED_BUILD" != "$REMOTE" ]; then
     86                        echo
     87                        echo "Also update the scripts as soon as there is a new release for this dedicated server build."
     88                        echo
     89                fi
    7590        else
    7691                echo "Engine is already at the newest build (local: $LOCAL, remote: $REMOTE)."
  • scripts/usr/local/lib/7dtd/commands/updatescripts.sh

    r59 r87  
    66        local LOCAL=$(cat /usr/local/lib/7dtd/VERSION | grep "Version" | cut -d\  -f2)
    77        local REMOTE=$(wget -qO- http://illy.bz/fi/7dtd/VERSION | grep "Version" | cut -d\  -f2)
     8       
     9        local LOCAL_BUILD=$(getLocalEngineVersion)
     10        local LOCAL_SUPPORTED_BUILD=$(cat /usr/local/lib/7dtd/VERSION | grep "DediBuild" | cut -d\  -f2)
     11        local REMOTE_SUPPORTED_BUILD=$(wget -qO- http://illy.bz/fi/7dtd/VERSION | grep "DediBuild" | cut -d\  -f2)
    812       
    913        local FORCED
     
    1519        if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then
    1620                echo "A newer version of the scripts is available."
    17                 echo "Local:     v.$LOCAL"
    18                 echo "Available: v.$REMOTE"
     21                echo "Local:     v.$LOCAL (supported dedi build: $LOCAL_SUPPORTED_BUILD)"
     22                echo "Available: v.$REMOTE (supported dedi build: $REMOTE_SUPPORTED_BUILD)"
    1923                echo
    2024                echo "Please check the release notes before continuing:"
    2125                echo "  https://7dtd.illy.bz/wiki/Release%20Notes"
    2226                echo
     27               
     28                if [ "$LOCAL_BUILD" != "$REMOTE_SUPPORTED_BUILD" ]; then
     29                        echo "NOTE: The newer scripts are made for a more recent build ($REMOTE_SUPPORTED_BUILD) of the dedicated server than you are running ($LOCAL_BUILD)!"
     30                        echo "You will have to update the engine after updating to those new scripts!"
     31                        echo
     32                fi
    2333               
    2434                while : ; do
     
    5262                chmod 0755 /usr/local/lib/7dtd -R
    5363               
     64                if [ -e $SDTD_BASE/engine/7DaysToDie_Data/Managed ]; then
     65                        cp /usr/local/lib/7dtd/server-fixes/* $SDTD_BASE/engine/7DaysToDie_Data/Managed/
     66                        chown $SDTD_USER.$SDTD_GROUP -R $SDTD_BASE/engine/7DaysToDie_Data/Managed/
     67                fi
     68
    5469                echo "Update done."
    5570                echo
     
    5873                echo "were new files added to the user folder /home/sdtd those changes"
    5974                echo "have not been applied!"
     75
     76                if [ "$LOCAL_BUILD" != "$REMOTE_SUPPORTED_BUILD" ]; then
     77                        echo
     78                        echo "Please do now update the engine by running '7dtd.sh updateengine'"
     79                fi
    6080        else
    6181                echo "Scripts are already at the newest version (v.$LOCAL)."
  • scripts/usr/local/lib/7dtd/monitor-log.sh

    r72 r87  
    1212LOG=$(getInstancePath $INSTANCE)/logs/$(date '+%Y-%m-%d_%H-%M-%S')_output.log
    1313CHATLOG=$(getInstancePath $INSTANCE)/logs/$(date '+%Y-%m-%d_%H-%M-%S')_chat.log
     14COMMANDLOG=$(getInstancePath $INSTANCE)/logs/$(date '+%Y-%m-%d_%H-%M-%S')_commandExecution.log
    1415
    1516timestamp() {
     
    1819
    1920handleConnect() {
    20         tel=$(telnetCommand $INSTANCE lp)
    21         playerline=$(echo "$tel" | tr -d '\r' | grep "id=$2,")
    22         #nickname=$(echo "$playerline" | sed -r 's/^.* id=[0-9]*, ([^,]*), pos=.*$/\1/')
    23         steamid=$(echo "$playerline" | sed -r 's/^.*, health=[0-9]*, ([0-9]*)$/\1/')
     21        local clientId="$1"
     22        local entityId="$2"
     23        local name="$3"
     24        local steamId="$4"
     25        local ip="$5"
    2426       
    25         if [ -z "$steamid" ]; then
    26                 return
    27         fi
    28 
    29         logPlayerConnect $INSTANCE "$2" "$steamid" "$3"
     27        logPlayerConnect $INSTANCE "$entityId" "$name" "$steamId" "$ip"
    3028
    3129        for H in $(getHooksFor playerConnect); do
    32                 $H $INSTANCE "$1" "$2" "$3" "$steamid"
     30                $H $INSTANCE "$clientId" "$entityId" "$name" "$steamId" "$ip"
    3331        done
    3432}
    3533
    3634handleDisconnect() {
    37         logPlayerDisconnect $INSTANCE "$2"
     35        local clientId="$1"
     36        local entityId="$2"
     37
     38        logPlayerDisconnect $INSTANCE "$entityId"
    3839
    3940        for H in $(getHooksFor playerDisconnect); do
    40                 $H $INSTANCE "$1" "$2" "$NICKNAME" "$STEAMID"
     41                $H $INSTANCE "$clientId" "$entityId" "$NICKNAME" "$STEAMID"
    4142        done
    4243}
     
    5051}
    5152
     53handleRemoteCommand() {
     54        local cmd="$1"
     55        local name="$2"
     56       
     57        echo "$(timestamp): Player \"$name\" executed \"$cmd\"" >> $COMMANDLOG
     58
     59        for H in $(getHooksFor remoteCommand); do
     60                $H $INSTANCE "$cmd" "$name"
     61        done
     62}
     63
     64handleTelnetCommand() {
     65        local cmd="$1"
     66        local ip="$2"
     67
     68        echo "$(timestamp): Telnet from \"$ip\" executed \"$cmd\"" >> $COMMANDLOG
     69
     70        for H in $(getHooksFor telnetCommand); do
     71                $H $INSTANCE "$cmd" "$ip"
     72        done
     73}
     74
     75
    5276if [ ! -d "$(getInstancePath $INSTANCE)/logs" ]; then
    5377        mkdir "$(getInstancePath $INSTANCE)/logs"
     
    6084echo "Starting instance $INSTANCE at $(timestamp)" >> $LOG
    6185echo >> $LOG
     86
     87rm $(getInstancePath $INSTANCE)/logs/current_output.log
     88rm $(getInstancePath $INSTANCE)/logs/current_chat.log
     89rm $(getInstancePath $INSTANCE)/logs/current_commandExecution.log
     90ln -s $LOG $(getInstancePath $INSTANCE)/logs/current_output.log
     91ln -s $CHATLOG $(getInstancePath $INSTANCE)/logs/current_chat.log
     92ln -s $COMMANDLOG $(getInstancePath $INSTANCE)/logs/current_commandExecution.log
    6293
    6394sleep 5
     
    73104        if [ -n "$line" ]; then
    74105                echo "$(timestamp): $line" >> $LOG
    75                 if [ -n "$(echo "$line" | grep '^RequestToSpawnPlayer:')" ]; then
    76                         entityId=$(expr "$line" : 'RequestToSpawnPlayer: \([0-9]*\), [0-9]*, .*, [0-9]*$')
    77                         playerId=$(expr "$line" : 'RequestToSpawnPlayer: [0-9]*, \([0-9]*\), .*, [0-9]*$')
    78                         playerName=$(expr "$line" : 'RequestToSpawnPlayer: [0-9]*, [0-9]*, \(.*\), [0-9]*$')
    79                         unknown=$(expr "$line" : 'RequestToSpawnPlayer: [0-9]*, [0-9]*, .*, \([0-9]*\)$')
     106                #Player connected, clientid=[0-9]*, entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=[0-9.]*$
     107                if [ -n "$(echo "$line" | grep '^Player connected,')" ]; then
     108                        clientId=$(expr "$line" : 'Player connected, clientid=\([0-9]*\), entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=[0-9.]*$')
     109                        entityId=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=\([0-9]*\), name=.*, steamid=[0-9]*, ip=[0-9.]*$')
     110                        playerName=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=[0-9]*, name=\(.*\), steamid=[0-9]*, ip=[0-9.]*$')
     111                        steamId=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=[0-9]*, name=.*, steamid=\([0-9]*\), ip=[0-9.]*$')
     112                        ip=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=\([0-9.]*\)$')
    80113                        sleep 1
    81                         handleConnect "$playerId" "$entityId" "$playerName"
    82                         unset entityId playerId playerName unknown
     114                        handleConnect "$clientId" "$entityId" "$playerName" "$steamId" "$ip"
     115                        unset clientId entityId playerName steamId ip
    83116                else
     117                #Removing player with id clientId=[0-9]*, entityId=[0-9]*$
    84118                if [ -n "$(echo "$line" | grep '^Removing player with id ')" ]; then
    85119                        playerId=$(expr "$line" : 'Removing player with id clientId=\([0-9]*\), entityId=[0-9]*$')
     
    88122                        unset playerId entityId
    89123                else
     124                #GMSG: .*$
    90125                if [ -n "$(echo "$line" | grep -E '^GMSG: .+')" ]; then
    91126                        msg=$(expr "$line" : 'GMSG: \(.*\)$')
    92127                        handleChat "$msg"
    93128                        unset msg
     129                else
     130                #Executed command ".*" from player ".*"$
     131                if [ -n "$(echo "$line" | grep '^Executed command ')" ]; then
     132                        cmd=$(expr "$line" : 'Executed command "\(.*\)" from player ".*"$')
     133                        nick=$(expr "$line" : 'Executed command ".*" from player "\(.*\)"$')
     134                        handleRemoteCommand "$cmd" "$nick"
     135                        unset cmd nick
     136                else
     137                #Telnet executed ".*" from: .*$
     138                if [ -n "$(echo "$line" | grep '^Telnet executed ')" ]; then
     139                        cmd=$(expr "$line" : 'Telnet executed "\(.*\)" from: .*$')
     140                        ip=$(expr "$line" : 'Telnet executed ".*" from: \(.*\)$')
     141                        handleTelnetCommand "$cmd" "$ip"
     142                        unset cmd ip
     143                fi
     144                fi
    94145                fi
    95146                fi
  • scripts/usr/local/lib/7dtd/playerlog.sh

    r71 r87  
    2424                -u "/Players/Player/@online" -v "false" \
    2525                "$PLAYERSXML"
     26        rm $(getInstancePath $INSTANCE)/logs/current_players.log
     27        ln -s $PLAYERSLOG $(getInstancePath $INSTANCE)/logs/current_players.log
    2628}
    2729
     
    3335#   4: Nick name
    3436logPlayerConnect() {
    35         ENTITYID="$2"
    36         STEAMID="$3"
    37         NICKNAME="$4"
     37        local ENTITYID="$2"
     38        local NICKNAME="$3"
     39        local STEAMID="$4"
     40        local IP="$5"
    3841
    39         echo "$(timestamp) +++ $ENTITYID $NICKNAME $STEAMID" >> "$PLAYERSLOG"
     42        echo "$(timestamp) +++ $ENTITYID $NICKNAME $STEAMID $IP" >> "$PLAYERSLOG"
    4043
    4144        createPlayerList
     
    5356                        -i "$XPATHBASE" -t attr -n "online" -v "true" \
    5457                        -i "$XPATHBASE" -t attr -n "entityid" -v "$ENTITYID" \
     58                        -i "$XPATHBASE" -t attr -n "lastIp" -v "$IP" \
    5559                        "$PLAYERSXML"
    5660        else
     
    6266                        -u "$XPATHBASE/@entityid" -v "$ENTITYID" \
    6367                        -u "$XPATHBASE/@logins" -v "$LOGINS" \
     68                        -u "$XPATHBASE/@lastIp" -v "$IP" \
    6469                        "$PLAYERSXML"
    6570        fi
Note: See TracChangeset for help on using the changeset viewer.