-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserverscript
More file actions
65 lines (63 loc) · 1.47 KB
/
serverscript
File metadata and controls
65 lines (63 loc) · 1.47 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#! /bin/bash
# Soldat Server Start/Stop/Restart Script
# Author: Nick Cooper (http://enesce.com)
case "$1" in
start)
echo "[*] Starting your Soldat Server..."
if [ -e soldatserver ]; then
if [ ! -x soldatserver ]; then
echo "[*] soldatserver isnt executable... Attempting to fix now..."
chmod u+x soldatserver
fi
if [ -x soldatserver ]; then
./soldatserver -d
else
echo "[*] ERROR: soldatserver isnt executable. Please fix this then start again."
exit 4
fi
else
echo "[*] Couldnt find soldatserver. Please re-download your Soldat Server."
exit 5
fi
;;
stop)
if [ -e ./logs/soldatserver.pid ]; then
echo "[*] Stopping your Soldat Server..."
if ( kill -TERM `cat ./logs/soldatserver.pid` ); then
for c in $(seq 1 300); do
if [ -e ./logs/soldatserver.pid ]; then
echo -n "."
sleep 1
fi
done
fi
if [ -e ./logs/soldatserver.pid ]; then
echo "[*] Soldatserver would not exit cleanly... Forcing Quit NOW."
kill -KILL `cat ./logs/soldatserver.pid`
rm ./logs/soldatserver.pid
sleep 5
else
echo "[*] Done."
fi
else
echo "[*] soldatserver.pid not found... Server not online?"
exit 7
fi
;;
restart)
$0 stop && $0 start || exit 1
;;
status)
if [ -e ./logs/soldatserver.pid ]; then
echo "[*] Server appears to be RUNNING."
exit 0
else
echo "[*] Server appears to be DOWN."
exit 3
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 2
esac
exit 0