Changeset 483 for scripts/usr/local/lib/7dtd
- Timestamp:
- Nov 14, 2023, 6:40:06 PM (12 months ago)
- Location:
- scripts/usr/local/lib/7dtd/commands
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/commands/instances.sh
r481 r483 18 18 19 19 sdtdSubcommandInstancesList() { 20 printf "%-*s | %-*s | %-*s | %-*s \n" 20 "Instance name" 8 "Running" 7 "Players" 5 "Port"21 printf -v line "%*s-+-%*s-+-%*s-+-%*s \n" 20 " " 8 " " 7 " " 5" "20 printf "%-*s | %-*s | %-*s | %-*s | %-*s | %-*s\n" 20 "Instance name" 8 "Running" 7 "Players" 9 "Game Port" 11 "Dashb. Port" 6 "Telnet" 21 printf -v line "%*s-+-%*s-+-%*s-+-%*s-+-%*s-+-%*s\n" 20 " " 8 " " 7 " " 9 " " 11 " " 6 " " 22 22 echo ${line// /-} 23 23 for I in $(getInstanceList); do … … 35 35 max=$(getConfigValue $I ServerMaxPlayerCount) 36 36 port=$(getConfigValue $I ServerPort) 37 38 printf "%-*s | %*s | %2s/%2d | %5d\n" 20 "$I" 8 "$run" $cur $max $port 37 cpState="disabled" 38 if [ "$(getConfigValue $I WebDashboardEnabled)" = "true" ]; then 39 cpState="$(getConfigValue $I WebDashboardPort)" 40 fi 41 telnet=$(getConfigValue $I TelnetPort) 42 43 printf "%-*s | %*s | %2s/%2d | %9d | %*s | %*s\n" 20 "$I" 8 "$run" $cur $max $port 11 "$cpState" 6 "$telnet" 39 44 done 40 45 } … … 136 141 local INSTANCE=$1 137 142 local IPATH=$(getInstancePath "$INSTANCE") 138 cat $IPATH/config.xml 143 xmlstarlet sel -t -m "//property" -v "@name" -o " = " -v "@value" -nl $IPATH/config.xml | sort 144 } 145 146 sdtdSubcommandInstancesPrintXml() { 147 if [ $(isValidInstance "$1") -eq 0 ]; then 148 echo "No instance given or not a valid instance!" 149 return 150 fi 151 152 local INSTANCE=$1 153 local IPATH=$(getInstancePath "$INSTANCE") 154 155 which pygmentize > /dev/null 2>&1 156 if [ $? -eq 0 ]; then 157 cat $IPATH/config.xml | pygmentize -l xml 158 else 159 cat $IPATH/config.xml 160 fi 139 161 } 140 162 … … 158 180 sdtdSubcommandInstancesPrintConfig "$@" 159 181 ;; 182 print_xml) 183 sdtdSubcommandInstancesPrintXml "$@" 184 ;; 160 185 *) 161 186 sdtdCommandInstancesHelp … … 175 200 line "edit <instance>" "Edit an existing instance" 176 201 line "delete <instance>" "Delete an existing instance" 202 line "print_config <instance>" "Print the current config of the instance to the console" 203 line "print_xml <instance>" "Print the config XML as is" 177 204 } 178 205 … … 184 211 case $1 in 185 212 2) 186 echo "list create edit delete print_config "213 echo "list create edit delete print_config print_xml" 187 214 ;; 188 215 3) 189 216 case $2 in 190 edit|delete|print_config )217 edit|delete|print_config|print_xml) 191 218 echo "$(getInstanceList)" 192 219 ;; -
scripts/usr/local/lib/7dtd/commands/status.sh
r258 r483 53 53 line "Port:" "$(getConfigValue $1 ServerPort)" 54 54 line "Public:" "$(getConfigValue $1 ServerIsPublic)" 55 if [ "$(getConfigValue $1 ControlPanelEnabled)" = "false" ]; then56 cp=" off"55 if [ "$(getConfigValue $1 WebDashboardEnabled)" = "false" ]; then 56 cp="disabled" 57 57 else 58 cp=" Port $(getConfigValue $1 ControlPanelPort), Pass $(getConfigValue $1 ControlPanelPassword)"58 cp="$(getConfigValue $1 WebDashboardPort)" 59 59 fi 60 60 line "Control Panel:" "$cp" … … 62 62 tn="off" 63 63 else 64 tn="Port $(getConfigValue $1 TelnetPort), Pass $(getConfigValue $1 TelnetPassword)"64 tn="Port $(getConfigValue $1 TelnetPort), Pass '$(getConfigValue $1 TelnetPassword)'" 65 65 fi 66 66 line "Telnet:" "$tn"
Note:
See TracChangeset
for help on using the changeset viewer.