Changeset 67 for scripts/usr/local/lib
- Timestamp:
- Jul 10, 2014, 9:59:02 PM (10 years ago)
- Location:
- scripts/usr/local/lib/7dtd
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/VERSION
r66 r67 1 Version: 2 42 Release: 2014-07- 081 Version: 25 2 Release: 2014-07-10 -
scripts/usr/local/lib/7dtd/commands/backup.sh
r61 r67 9 9 if [ ! -d "$SDTD_BASE/instances" ]; then 10 10 return 11 fi 12 13 if [ "$SDTD_BACKUP_SAVEWORLD" == "true" ]; then 14 for I in $(getInstanceList); do 15 if [ $(isRunning $I) -eq 1 ]; then 16 telnetCommand $I saveworld 2 17 fi 18 done 11 19 fi 12 20 -
scripts/usr/local/lib/7dtd/commands/start.sh
r66 r67 26 26 fi 27 27 28 setAllPlayersOffline $1 29 rm -f $(getInstancePath $1)/output_log.txt 28 if [ ! -d "$(getInstancePath $1)/logs" ]; then 29 mkdir "$(getInstancePath $1)/logs" 30 fi 31 rm -f $(getInstancePath $1)/logs/output_log.txt 30 32 31 33 for H in $(getHooksFor serverPreStart); do … … 36 38 SSD_DAEMON="--background --no-close" 37 39 SSD_USER="--chuid $SDTD_USER:$SDTD_GROUP --user $SDTD_USER" 38 OPTS="-logfile $(getInstancePath $1)/ output_log.txt -configfile=$(getInstancePath $1)/config.xml -dedicated"40 OPTS="-logfile $(getInstancePath $1)/logs/output_log.txt -configfile=$(getInstancePath $1)/config.xml -dedicated" 39 41 40 LD_LIBRARY_PATH=$SDTD_BASE/linux_files $SSD --start $SSD_PID $SSD_DAEMON $SSD_USER --chdir $SDTD_BASE/engine --exec $SDTD_BASE/engine/7DaysToDie.x86 -- $OPTS > $(getInstancePath $1)/ stdout.log 2>&142 LD_LIBRARY_PATH=$SDTD_BASE/linux_files $SSD --start $SSD_PID $SSD_DAEMON $SSD_USER --chdir $SDTD_BASE/engine --exec $SDTD_BASE/engine/7DaysToDie.x86 -- $OPTS > $(getInstancePath $1)/logs/stdout.log 2>&1 41 43 sleep 1 42 44 -
scripts/usr/local/lib/7dtd/common.sh
r64 r67 299 299 300 300 . /usr/local/lib/7dtd/help.sh 301 . /usr/local/lib/7dtd/playerlog.sh302 301 . /usr/local/lib/7dtd/serverconfig.sh 303 302 for M in /usr/local/lib/7dtd/commands/*.sh; do -
scripts/usr/local/lib/7dtd/monitor-log.sh
r64 r67 2 2 3 3 . /usr/local/lib/7dtd/common.sh 4 . /usr/local/lib/7dtd/playerlog.sh 4 5 5 6 if [ $(isValidInstance $1) -eq 0 ]; then … … 9 10 10 11 INSTANCE=$1 11 LOG=$(getInstancePath $INSTANCE)/ output.log12 CHATLOG=$(getInstancePath $INSTANCE)/ chat.log12 LOG=$(getInstancePath $INSTANCE)/logs/$(date '+%Y-%m-%d_%H-%M-%S')_output.log 13 CHATLOG=$(getInstancePath $INSTANCE)/logs/$(date '+%Y-%m-%d_%H-%M-%S')_chat.log 13 14 14 15 timestamp() { … … 49 50 } 50 51 52 if [ ! -d "$(getInstancePath $INSTANCE)/logs" ]; then 53 mkdir "$(getInstancePath $INSTANCE)/logs" 54 fi 55 56 setAllPlayersOffline 57 51 58 echo >> $LOG 52 59 echo >> $LOG … … 62 69 $NOBUF tr -d '\r' | 63 70 $NOBUF grep -v "^(Filename: " | 71 $NOBUF sed -r 's/^[0-9]+,[0-9]+ (.*)$/\1/' | 64 72 while read line ; do 65 73 if [ -n "$line" ]; then -
scripts/usr/local/lib/7dtd/playerlog.sh
r63 r67 1 1 #!/bin/bash 2 3 PLAYERSXML=$(getInstancePath $1)/players.xml 4 PLAYERSLOG=$(getInstancePath $1)/logs/$(date '+%Y-%m-%d_%H-%M-%S')_players.log 2 5 3 6 timestamp() { … … 6 9 7 10 # Create empty player list if not existing 8 # Params:9 # 1: Instance name10 11 createPlayerList() { 11 PLAYERLIST=$(getInstancePath $1)/players.xml 12 if [ ! -f $PLAYERLIST ]; then 13 echo "<Players/>" > $PLAYERLIST 12 if [ ! -f $PLAYERSXML ]; then 13 echo "<Players/>" > $PLAYERSXML 14 14 fi 15 15 } 16 16 17 17 # Set all players for an instance to offline (on startup/shutdown) 18 # Params:19 # 1: Instance name20 18 setAllPlayersOffline() { 21 PLAYERLIST=$(getInstancePath $1)/players.xml 22 createPlayerList "$1" 19 createPlayerList 23 20 $XMLSTARLET ed -L \ 24 21 -u "/Players/Player/@online" -v "false" \ 25 $PLAYER LIST22 $PLAYERSXML 26 23 } 27 24 … … 33 30 # 4: Nick name 34 31 logPlayerConnect() { 35 PLAYERLOG=$(getInstancePath $1)/players.log36 PLAYERLIST=$(getInstancePath $1)/players.xml37 32 ENTITYID="$2" 38 33 STEAMID="$3" 39 34 NICKNAME="$4" 40 35 41 echo "$(timestamp) +++ $ENTITYID $NICKNAME $STEAMID" >> $PLAYER LOG36 echo "$(timestamp) +++ $ENTITYID $NICKNAME $STEAMID" >> $PLAYERSLOG 42 37 43 createPlayerList "$1"38 createPlayerList 44 39 45 40 XPATHBASE="/Players/Player[@steamid='$STEAMID']" 46 41 47 if [ -z $($XMLSTARLET sel -t -v "$XPATHBASE/@steamid" $PLAYER LIST) ]; then42 if [ -z $($XMLSTARLET sel -t -v "$XPATHBASE/@steamid" $PLAYERSXML) ]; then 48 43 $XMLSTARLET ed -L \ 49 44 -s "/Players" -t elem -n "Player" -v "" \ … … 55 50 -i "$XPATHBASE" -t attr -n "online" -v "true" \ 56 51 -i "$XPATHBASE" -t attr -n "entityid" -v "$ENTITYID" \ 57 $PLAYER LIST52 $PLAYERSXML 58 53 else 59 LOGINS=$($XMLSTARLET sel -t -v "$XPATHBASE/@logins" $PLAYER LIST)54 LOGINS=$($XMLSTARLET sel -t -v "$XPATHBASE/@logins" $PLAYERSXML) 60 55 (( LOGINS++ )) 61 56 $XMLSTARLET ed -L \ … … 64 59 -u "$XPATHBASE/@entityid" -v "$ENTITYID" \ 65 60 -u "$XPATHBASE/@logins" -v "$LOGINS" \ 66 $PLAYER LIST61 $PLAYERSXML 67 62 fi 68 63 } … … 73 68 # 2: Entity ID 74 69 logPlayerDisconnect() { 75 PLAYERLOG=$(getInstancePath $1)/players.log76 PLAYERLIST=$(getInstancePath $1)/players.xml77 70 ENTITYID="$2" 78 71 79 createPlayerList "$1"72 createPlayerList 80 73 81 74 XPATHBASE="/Players/Player[@entityid='$ENTITYID'][@online='true']" 82 75 83 if [ -f $PLAYER LIST]; then84 if [ ! -z $($XMLSTARLET sel -t -v "$XPATHBASE/@steamid" $PLAYER LIST) ]; then85 NICKNAME=$($XMLSTARLET sel -t -v "$XPATHBASE/@nick" $PLAYER LIST)86 STEAMID=$($XMLSTARLET sel -t -v "$XPATHBASE/@steamid" $PLAYER LIST)87 LOGINTIME=$($XMLSTARLET sel -t -v "$XPATHBASE/@lastlogin" $PLAYER LIST)88 PLAYTIME=$($XMLSTARLET sel -t -v "$XPATHBASE/@playtime" $PLAYER LIST)76 if [ -f $PLAYERSXML ]; then 77 if [ ! -z $($XMLSTARLET sel -t -v "$XPATHBASE/@steamid" $PLAYERSXML) ]; then 78 NICKNAME=$($XMLSTARLET sel -t -v "$XPATHBASE/@nick" $PLAYERSXML) 79 STEAMID=$($XMLSTARLET sel -t -v "$XPATHBASE/@steamid" $PLAYERSXML) 80 LOGINTIME=$($XMLSTARLET sel -t -v "$XPATHBASE/@lastlogin" $PLAYERSXML) 81 PLAYTIME=$($XMLSTARLET sel -t -v "$XPATHBASE/@playtime" $PLAYERSXML) 89 82 NOW=$(date '+%s') 90 83 PLAYTIME=$(( PLAYTIME + NOW - LOGINTIME )) … … 92 85 -u "$XPATHBASE/@playtime" -v "$PLAYTIME" \ 93 86 -u "$XPATHBASE/@online" -v "false" \ 94 $PLAYER LIST87 $PLAYERSXML 95 88 fi 96 89 fi 97 90 98 echo "$(timestamp) --- $ENTITYID $NICKNAME $STEAMID" >> $PLAYER LOG91 echo "$(timestamp) --- $ENTITYID $NICKNAME $STEAMID" >> $PLAYERSLOG 99 92 } 100 93 -
scripts/usr/local/lib/7dtd/serverconfig.sh
r45 r67 684 684 685 685 686 serverconfig_MaxSpawnedZombies_QueryName() { 687 echo "Maximum number of concurrent zombies" 688 } 689 serverconfig_MaxSpawnedZombies_Type() { 690 echo "number" 691 } 692 serverconfig_MaxSpawnedZombies_Default() { 693 echo "60" 694 } 695 696 697 serverconfig_VACEnabled_QueryName() { 698 echo "Enable Valve Anti Cheat" 699 } 700 serverconfig_VACEnabled_Type() { 701 echo "boolean" 702 } 703 serverconfig_VACEnabled_Default() { 704 echo "true" 705 } 706 serverconfig_VACEnabled_ErrorMessage() { 707 echo "Not a valid boolean given (true/false or yes/no or y/n)." 708 } 709 710 686 711 687 712 … … 696 721 for CV in \ 697 722 ServerName ServerPassword ServerIsPublic ServerPort ServerMaxPlayerCount \ 698 DisableNAT \723 DisableNAT VACEnabled MaxSpawnedZombies \ 699 724 ; do 700 725 $1 $CV
Note:
See TracChangeset
for help on using the changeset viewer.