Changeset 234 for scripts/usr/local
- Timestamp:
- May 1, 2015, 11:22:18 AM (10 years ago)
- Location:
- scripts/usr/local/lib/7dtd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/VERSION
r231 r234 1 Version: 8 32 Release: 2015-0 4-183 DediBuild: 5931101 Version: 86 2 Release: 2015-05-01 3 DediBuild: 605981 4 4 -
scripts/usr/local/lib/7dtd/monitor-log.sh
r220 r234 20 20 21 21 handleConnect() { 22 local clientId="$1" 23 local entityId="$2" 24 local name="$3" 25 local steamId="$4" 26 local ip="$5" 22 local entityId="$1" 23 local name="$2" 24 local steamId="$3" 25 local ip="$4" 27 26 28 27 logPlayerConnect $INSTANCE "$entityId" "$name" "$steamId" "$ip" 29 28 30 29 for H in $(getHooksFor playerConnect); do 31 $H $INSTANCE "$ clientId" "$entityId" "$name" "$steamId" "$ip"30 $H $INSTANCE "$entityId" "$name" "$steamId" "$ip" 32 31 done 33 32 } 34 33 35 34 handleDisconnect() { 36 local clientId="$1"35 local playerId="$1" 37 36 local entityId="$2" 38 37 … … 40 39 41 40 for H in $(getHooksFor playerDisconnect); do 42 $H $INSTANCE "$ clientId" "$entityId" "$NICKNAME" "$STEAMID"41 $H $INSTANCE "$playerId" "$entityId" "$NICKNAME" "$STEAMID" 43 42 done 44 43 } … … 99 98 while read line ; do 100 99 if [ -n "$line" ]; then 101 #Player connected, clientid=[0-9]*, entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=[0-9.]*$ 100 #Player connected, entityid=1278, name=termo2, steamid=76561197997439820, ip=178.203.27.140 101 #Player connected, entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=[0-9.]*$ 102 102 if [ -n "$(echo "$line" | grep '^Player connected,')" ]; then 103 clientId=$(expr "$line" : 'Player connected, clientid=\([0-9]*\), entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=[0-9.]*$') 104 entityId=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=\([0-9]*\), name=.*, steamid=[0-9]*, ip=[0-9.]*$') 105 playerName=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=[0-9]*, name=\(.*\), steamid=[0-9]*, ip=[0-9.]*$') 106 steamId=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=[0-9]*, name=.*, steamid=\([0-9]*\), ip=[0-9.]*$') 107 ip=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=\([0-9.]*\)$') 103 entityId=$(expr "$line" : 'Player connected, entityid=\([0-9]*\), name=.*, steamid=[0-9]*, ip=[0-9.]*$') 104 playerName=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=\(.*\), steamid=[0-9]*, ip=[0-9.]*$') 105 steamId=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=.*, steamid=\([0-9]*\), ip=[0-9.]*$') 106 ip=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=\([0-9.]*\)$') 108 107 sleep 1 109 handleConnect "$ clientId" "$entityId" "$playerName" "$steamId" "$ip"110 unset clientIdentityId playerName steamId ip108 handleConnect "$entityId" "$playerName" "$steamId" "$ip" 109 unset entityId playerName steamId ip 111 110 else 112 # Removing player with id clientId=[0-9]*, entityId=[0-9]*$113 if [ -n "$(echo "$line" | grep '^ Removing player with id ')" ]; then114 playerId=$(expr "$line" : 'Removing player with id clientId=\([0-9]*\), entityId=[0-9]*$')115 entityId=$(expr "$line" : 'Removing player with id clientId=[0-9]*, entityId=\([0-9]*\)$')111 #Player disconnected: EntityID=[0-9]*, PlayerID='[0-9]*', OwnerID='[0-9]*', PlayerName='.*'$ 112 if [ -n "$(echo "$line" | grep '^Player disconnected: ')" ]; then 113 playerId=$(expr "$line" : "Player disconnected: EntityID=[0-9]*, PlayerID='\([0-9]*\)', OwnerID='[0-9]*', PlayerName='.*'$") 114 entityId=$(expr "$line" : "Player disconnected: EntityID=\([0-9]*\), PlayerID='[0-9]*', OwnerID='[0-9]*', PlayerName='.*'$") 116 115 handleDisconnect "$playerId" "$entityId" 117 116 unset playerId entityId … … 123 122 unset msg 124 123 else 125 #Execut ed command ".*" from player ".*"$126 if [ -n "$(echo "$line" | grep '^Execut ed command ')" ]; then127 cmd=$(expr "$line" : 'Executed command "\(.*\)" from player ".*"$')128 nick=$(expr "$line" : 'Executed command ".*" from player "\(.*\)"$')124 #Executing command ".*" from client ".*"$ 125 if [ -n "$(echo "$line" | grep '^Executing command '.*' from client')" ]; then 126 cmd=$(expr "$line" : "Executing command '\(.*\)' from client .*$") 127 nick=$(expr "$line" : "Executing command '.*' from client \(.*\)$") 129 128 handleRemoteCommand "$cmd" "$nick" 130 129 unset cmd nick 131 130 else 132 # Telnet executed ".*" from: .*$133 if [ -n "$(echo "$line" | grep '^ Telnet executed ')" ]; then134 cmd=$(expr "$line" : 'Telnet executed "\(.*\)" from: .*$')135 ip=$(expr "$line" : 'Telnet executed ".*" from: \(.*\)$')131 #Executing command ".*" by Telnet from .*$ 132 if [ -n "$(echo "$line" | grep '^Executing command '.*' by Telnet from ')" ]; then 133 cmd=$(expr "$line" : "Executing command '\(.*\)' by Telnet from .*$") 134 ip=$(expr "$line" : "Executing command '.*' by Telnet from \(.*\)$") 136 135 handleTelnetCommand "$cmd" "$ip" 137 136 unset cmd ip
Note:
See TracChangeset
for help on using the changeset viewer.