- Timestamp:
- Jun 3, 2014, 8:01:56 PM (10 years ago)
- Location:
- scripts/usr/local/lib/7dtd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/commands/stop.sh
r25 r46 32 32 33 33 echo "Trying to gracefully shutdown..." 34 tmp=$(telnetCommand $1 shutdown )34 tmp=$(telnetCommand $1 shutdown "0.5") 35 35 echo "Waiting for server to shut down..." 36 36 -
scripts/usr/local/lib/7dtd/common.sh
r25 r46 151 151 # 1: Instance name 152 152 # 2: Command 153 # 3: (Optional) Timeout in sec, defaulting to 1 153 154 # Returns: 154 155 # String of telnet output … … 158 159 local TEL_PASS=$(getConfigValue $1 TelnetPassword) 159 160 if [ "$TEL_ENABLED" = "true" ] && [ -n "$TEL_PASS" ]; then 160 echo -e "$TEL_PASS\n$2\nexit" | nc -q 2 127.0.0.1 $TEL_PORT 161 local TEMPFILE=$(mktemp) 162 rm -f $TEMPFILE 163 mkfifo $TEMPFILE 164 exec 3<> $TEMPFILE 165 nc 127.0.0.1 $TEL_PORT <&3 & 166 local NCPID=$! 167 printf "$TEL_PASS\n$2\n" >&3 168 sleep ${3:-1} 169 printf "exit\n" >&3 170 sleep 0.2 171 kill -9 $NCPID > /dev/null 2>&1 172 exec 3>&- 173 rm -f $TEMPFILE 161 174 else 162 175 echo "Telnet not enabled or no password set."
Note:
See TracChangeset
for help on using the changeset viewer.