Browse Source

fix(stop): sdtd telnet stop will now work with no password set

pull/2150/head
Daniel Gibbs 6 years ago
parent
commit
43a69debd5
  1. 53
      lgsm/functions/command_stop.sh

53
lgsm/functions/command_stop.sh

@ -87,26 +87,39 @@ fn_stop_graceful_goldsource(){
# Attempts graceful of 7 Days To Die using telnet. # Attempts graceful of 7 Days To Die using telnet.
fn_stop_telnet_sdtd(){ fn_stop_telnet_sdtd(){
if [ -z "${telnetpass}" ]; then if [ -z "${telnetpass}" ]||[ "${telnetpass}" == "NOT SET" ]; then
telnetpass="NOTSET" sdtd_telnet_shutdown=$( expect -c '
fi proc abort {} {
sdtd_telnet_shutdown=$( expect -c ' puts "Timeout or EOF\n"
proc abort {} { exit 1
puts "Timeout or EOF\n" }
exit 1 spawn telnet '"${telnetip}"' '"${telnetport}"'
} expect {
spawn telnet '"${telnetip}"' '"${telnetport}"' "session." { send "shutdown\r" }
expect { default abort
"password:" { send "'"${telnetpass}"'\r" } }
default abort expect { eof }
} puts "Completed.\n"
expect { ')
"session." { send "shutdown\r" } else
default abort sdtd_telnet_shutdown=$( expect -c '
} proc abort {} {
expect { eof } puts "Timeout or EOF\n"
puts "Completed.\n" exit 1
') }
spawn telnet '"${telnetip}"' '"${telnetport}"'
expect {
"password:" { send "'"${telnetpass}"'\r" }
default abort
}
expect {
"session." { send "shutdown\r" }
default abort
}
expect { eof }
puts "Completed.\n"
')
fi
} }
fn_stop_graceful_sdtd(){ fn_stop_graceful_sdtd(){

Loading…
Cancel
Save