graceful terraria shutdown

This commit is contained in:
Matthew Tran 2023-09-06 13:21:48 +00:00
parent 3c6c97f9f8
commit 1fc6ac77e2
2 changed files with 6 additions and 5 deletions

View File

@ -3,7 +3,7 @@ FROM ubuntu:22.04
WORKDIR /root
RUN apt-get update && apt-get upgrade
RUN apt-get install -y wget unzip tmux
RUN apt-get install -y wget unzip
# from https://terraria.fandom.com/wiki/Server (currently 1.4.4.9)
RUN wget https://terraria.org/api/download/pc-dedicated-server/terraria-server-1449.zip

View File

@ -1,12 +1,13 @@
#!/bin/sh
cleanup() {
echo "TODO"
echo "exit\n" > cmd
}
trap 'cleanup' TERM
# TODO use tmux so can send exit
./TerrariaServer.bin.x86_64 -config config.txt -pass $(cat password.txt) &
mkfifo cmd
./TerrariaServer.bin.x86_64 -config config.txt -pass $(cat password.txt) < cmd &
echo "help\n" > cmd # shell waits for FIFO to be opened for writing before starting program!
wait $! # wait for SIGTERM
# wait $! # wait for server to stop
wait $! # wait for server to stop