summarylogtreecommitdiffstats
path: root/tshock.sh
diff options
context:
space:
mode:
authorSefa Eyeoglu2020-01-02 13:44:44 +0100
committerSefa Eyeoglu2020-01-02 13:44:44 +0100
commit8463f18c7cc23b66870679462e8521c2d3d23e2c (patch)
treebbdcd8da7f1c7f0cca9ad31d360513b729d79150 /tshock.sh
parentcfe5175c2b130a5a07ad44f31914e96d77dcc10f (diff)
downloadaur-8463f18c7cc23b66870679462e8521c2d3d23e2c.tar.gz
upgpkg: tshock 14.3.26-1
upstream release Update to 4.3.26. Switch to building instead of downloading binary
Diffstat (limited to 'tshock.sh')
-rw-r--r--tshock.sh69
1 files changed, 38 insertions, 31 deletions
diff --git a/tshock.sh b/tshock.sh
index 989f5741851b..4e3afbed47f7 100644
--- a/tshock.sh
+++ b/tshock.sh
@@ -3,16 +3,16 @@
CONFDIR='/etc/conf.d/tshock'
if [ -n "$2" ]; then
- INSTANCE=$2
+ INSTANCE=$2
else
- INSTANCE=default
+ INSTANCE=default
fi
if [ -r ${CONFDIR}/${INSTANCE}.conf ]; then
- source ${CONFDIR}/${INSTANCE}.conf
+ source ${CONFDIR}/${INSTANCE}.conf
else
- echo "TShock could not be started because ${CONFDIR}/${INSTANCE}.conf could not be read."
- exit 1
+ echo "TShock could not be started because ${CONFDIR}/${INSTANCE}.conf could not be read."
+ exit 1
fi
TMUX_CONSOLE=tshock-console-${INSTANCE}
@@ -55,35 +55,42 @@ TMUX_CONSOLE=tshock-console-${INSTANCE}
## wiki use.
case "$1" in
- start)
- if [ ! $(tmux has -t ${TMUX_CONSOLE} &> /dev/null) ]; then
- tmux new-session -d -s ${TMUX_CONSOLE} -d "cd ${BASEDIR}; mono --server --gc=sgen -O=all TerrariaServer.exe -port ${PORT} -worldpath ${WORLDDIR} -world ${WORLDDIR}/${WORLD}.wld -autocreate ${SIZE}"
- if [ $? -gt 0 ]; then
- exit 1
- fi
- else
- echo "This TShock instance is already running"
- exit 1
- fi
- ;;
+ start)
+ if tmux has-session -t ${TMUX_CONSOLE} &> /dev/null ; then
+ echo "This TShock instance is already running"
+ exit 1
+ else
+ tmux new-session -d -s ${TMUX_CONSOLE} -d "cd ${BASEDIR}; mono --server --gc=sgen -O=all TerrariaServer.exe -port ${PORT} -worldpath ${WORLDDIR} -world ${WORLDDIR}/${WORLD}.wld -autocreate ${SIZE}"
+ if [ $? -gt 0 ]; then
+ echo "Could not start instance"
+ exit 1
+ fi
+ fi
+ ;;
- stop)
- tmux send-keys -t ${TMUX_CONSOLE} 'broadcast NOTICE: Server shutting down in 5 seconds!' C-m
- sleep 5
- tmux send-keys -t ${TMUX_CONSOLE} 'exit' C-m
- sleep 10
- ;;
+ stop)
+ if tmux has-session -t ${TMUX_CONSOLE} &> /dev/null ; then
+ tmux send-keys -t ${TMUX_CONSOLE} 'broadcast NOTICE: Server shutting down in 5 seconds!' C-m
+ sleep 5
+ tmux send-keys -t ${TMUX_CONSOLE} 'exit' C-m
+ sleep 10
+ else
+ echo "This TShock instance is not running"
+ exit 1
+ fi
+ ;;
- console)
- tmux attach -t ${TMUX_CONSOLE}
- ;;
+ console)
+ if tmux has-session -t ${TMUX_CONSOLE} &> /dev/null ; then
+ tmux attach -t ${TMUX_CONSOLE}
+ else
+ echo "This TShock instance is not running"
+ exit 1
+ fi
+ ;;
- install)
- bash -c "cd ${BASEDIR}; mono --server --gc=sgen -O=all TerrariaServer.exe -worldpath ${WORLDDIR}"
- ;;
-
- *)
- echo "usage: $0 {start|backup|console|install} [instance]"
+ *)
+ echo "usage: $0 {start|backup|console} [instance]"
esac
exit 0