-
Notifications
You must be signed in to change notification settings - Fork 8
/
restarter
executable file
·52 lines (36 loc) · 932 Bytes
/
restarter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Config
servername="OTXSERVER"
##sqlpassword=""
# Allow core dumps
ulimit -c unlimited
# Set working directory
#cd ~/server/
# Main loop
while true;
do
date=$(date "+%d-%m-%y-%H-%M-%S")
filename="${servername}-${date}"
logdir="/media/server/serverlog"
logfile="${logdir}/${filename}.log"
# Verifica se o diretório de log existe, se não, cria
if [ ! -d "$logdir" ]; then
mkdir -p "$logdir"
fi
expect -c "
spawn gdb -ex \"set disable-randomization off\" -ex \"set detach-on-fork off\" --args ./theotxserver
set timeout -1
expect -re \".*gdb\"
send \"run\r\"
expect -re \".*gdb\"
send \"call g_game.saveGameState(13)\r\"
send \"bt full\r\"
send \"detach\r\"
send \"quit\r\"
expect -re \"Quit anyway? (y or n)\"
send \"y\r\"
sleep 1
interact
" |& tee "$logfile"
sleep 1
done;