1 |
jcrisp |
1.1 |
diff -ruN smeserver-teamspeak-server-3.1.old/root/etc/e-smith/db/configuration/defaults/teamspeak/UDPPort smeserver-teamspeak-server-3.1/root/etc/e-smith/db/configuration/defaults/teamspeak/UDPPort |
2 |
|
|
--- smeserver-teamspeak-server-3.1.old/root/etc/e-smith/db/configuration/defaults/teamspeak/UDPPort 2018-03-05 13:58:35.286000777 +0100 |
3 |
|
|
+++ smeserver-teamspeak-server-3.1/root/etc/e-smith/db/configuration/defaults/teamspeak/UDPPort 2018-03-05 14:21:25.978001236 +0100 |
4 |
|
|
@@ -1 +1 @@ |
5 |
|
|
-8767 |
6 |
|
|
+9987 |
7 |
|
|
\ No newline at end of file |
8 |
|
|
diff -ruN smeserver-teamspeak-server-3.1.old/root/etc/rc.d/init.d/teamspeak smeserver-teamspeak-server-3.1/root/etc/rc.d/init.d/teamspeak |
9 |
|
|
--- smeserver-teamspeak-server-3.1.old/root/etc/rc.d/init.d/teamspeak 2018-03-05 13:58:35.286000777 +0100 |
10 |
|
|
+++ smeserver-teamspeak-server-3.1/root/etc/rc.d/init.d/teamspeak 2018-03-05 14:07:59.045000741 +0100 |
11 |
|
|
@@ -1,101 +1,104 @@ |
12 |
|
|
-#! /bin/bash |
13 |
|
|
-# Copyright (c) 2004 TeamSpeak team All rights reserved. |
14 |
|
|
-# |
15 |
|
|
-# Author: pwk.linuxfan 2004 |
16 |
|
|
-# Modified By Sylvain Gomez - sylvaingomez AT free.fr |
17 |
|
|
-# |
18 |
|
|
+#!/bin/bash |
19 |
|
|
+# Copyright (c) 2010 TeamSpeak Systems GmbH |
20 |
|
|
+# All rights reserved |
21 |
|
|
+ |
22 |
|
|
# chkconfig: 345 85 15 |
23 |
|
|
# description: Runs and kills TeamSpeak Voice server at boot time and shutdown. |
24 |
|
|
# Source function library. |
25 |
|
|
-#. /etc/rc.d/init.d/functions |
26 |
|
|
- |
27 |
|
|
+. /etc/rc.d/init.d/functions |
28 |
|
|
|
29 |
|
|
# START OF CONFIG SECTION |
30 |
|
|
# WARNING ! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT |
31 |
|
|
USER=teamspeak |
32 |
|
|
-DIR=/opt/teamspeak |
33 |
|
|
# END OF CONFIG SECTION |
34 |
|
|
|
35 |
|
|
+COMMANDLINE_PARAMETERS="${2}" #add any command line parameters you want to pass here |
36 |
|
|
+D1=$(readlink -f "$0") |
37 |
|
|
+BINARYPATH="/opt/teamspeak" |
38 |
|
|
+cd "${BINARYPATH}" |
39 |
|
|
+LIBRARYPATH="$(pwd)" |
40 |
|
|
+BINARYNAME="ts3server" |
41 |
|
|
|
42 |
|
|
case "$1" in |
43 |
|
|
start) |
44 |
|
|
- if [ -e $DIR/tsserver2.pid ]; then |
45 |
|
|
- echo "tsserver2.pid already exists...server already started ?"; |
46 |
|
|
- echo "If you are sure the server is not running, delete tsserver2.pid" |
47 |
|
|
- exit 1 |
48 |
|
|
- else |
49 |
|
|
- echo "starting the teamspeak2 server" |
50 |
|
|
- if [ -e $DIR/server_linux ]; then |
51 |
|
|
- if [ ! -x $DIR/server_linux ]; then |
52 |
|
|
- echo "server_linux is not executable, trying to set it" |
53 |
|
|
- chmod u+x $DIR/server_linux |
54 |
|
|
- fi |
55 |
|
|
- if [ -x $DIR/server_linux ]; then |
56 |
|
|
- WD=`pwd` |
57 |
|
|
- cd $DIR |
58 |
|
|
- su $USER -c "$DIR/server_linux -PID=tsserver2.pid" |
59 |
|
|
- cd $WD |
60 |
|
|
+ if [ -e ts3server.pid ]; then |
61 |
|
|
+ if ( kill -0 $(cat ts3server.pid) 2> /dev/null ); then |
62 |
|
|
+ echo "The server is already running, try restart or stop" |
63 |
|
|
+ exit 1 |
64 |
|
|
+ else |
65 |
|
|
+ echo "ts3server.pid found, but no server running. Possibly your previously started server crashed" |
66 |
|
|
+ echo "Please view the logfile for details." |
67 |
|
|
+ rm ts3server.pid |
68 |
|
|
+ fi |
69 |
|
|
+ fi |
70 |
|
|
+ echo "Starting the TeamSpeak 3 server" |
71 |
|
|
+ if [ -e "$BINARYNAME" ]; then |
72 |
|
|
+ if [ ! -x "$BINARYNAME" ]; then |
73 |
|
|
+ echo "${BINARYNAME} is not executable, trying to set it" |
74 |
|
|
+ chmod u+x "${BINARYNAME}" |
75 |
|
|
+ fi |
76 |
|
|
+ if [ -x "$BINARYNAME" ]; then |
77 |
|
|
+ |
78 |
|
|
+ LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" |
79 |
|
|
+ exec /usr/local/bin/setuidgid ${USER} "./${BINARYNAME}" ${COMMANDLINE_PARAMETERS} > /dev/null & PID=$! |
80 |
|
|
+ ps -p ${PID} > /dev/null 2>&1 |
81 |
|
|
+ if [ "$?" -ne "0" ]; then |
82 |
|
|
+ echo "TeamSpeak 3 server could not start" |
83 |
|
|
else |
84 |
|
|
- echo "server_linux is not executable, fix this" |
85 |
|
|
- exit 4 |
86 |
|
|
+ echo $PID > ts3server.pid |
87 |
|
|
+ echo "TeamSpeak 3 server started, for details please view the log file" |
88 |
|
|
fi |
89 |
|
|
else |
90 |
|
|
- echo "Couldnt find server_linux" |
91 |
|
|
- exit 5 |
92 |
|
|
+ echo "${BINARNAME} is not exectuable, cannot start TeamSpeak 3 server" |
93 |
|
|
fi |
94 |
|
|
+ else |
95 |
|
|
+ echo "Could not find binary, aborting" |
96 |
|
|
+ exit 5 |
97 |
|
|
fi |
98 |
|
|
;; |
99 |
|
|
- stop) |
100 |
|
|
- if [ -e $DIR/tsserver2.pid ]; then |
101 |
|
|
- echo -n "stopping the teamspeak2 server" |
102 |
|
|
- if ( kill -TERM `cat $DIR/tsserver2.pid` ); then |
103 |
|
|
- for c in $(seq 1 300); do |
104 |
|
|
- if [ -e $DIR/tsserver2.pid ]; then |
105 |
|
|
+ stop) |
106 |
|
|
+ if [ -e ts3server.pid ]; then |
107 |
|
|
+ echo -n "Stopping the TeamSpeak 3 server" |
108 |
|
|
+ if ( kill -TERM $(cat ts3server.pid) 2> /dev/null ); then |
109 |
|
|
+ c=1 |
110 |
|
|
+ while [ "$c" -le 300 ]; do |
111 |
|
|
+ if ( kill -0 $(cat ts3server.pid) 2> /dev/null ); then |
112 |
|
|
echo -n "." |
113 |
|
|
sleep 1 |
114 |
|
|
+ else |
115 |
|
|
+ break |
116 |
|
|
fi |
117 |
|
|
+ c=$(($c+1)) |
118 |
|
|
done |
119 |
|
|
fi |
120 |
|
|
- if [ -e $DIR/tsserver2.pid ]; then |
121 |
|
|
- echo "server does not shutdown cleanly - killing" |
122 |
|
|
- kill -KILL `cat $DIR/tsserver2.pid` |
123 |
|
|
- rm $DIR/tsserver2.pid |
124 |
|
|
- sleep 5 |
125 |
|
|
+ if ( kill -0 $(cat ts3server.pid) 2> /dev/null ); then |
126 |
|
|
+ echo "Server is not shutting down cleanly - killing" |
127 |
|
|
+ kill -KILL $(cat ts3server.pid) |
128 |
|
|
else |
129 |
|
|
echo "done" |
130 |
|
|
fi |
131 |
|
|
+ rm ts3server.pid |
132 |
|
|
else |
133 |
|
|
- echo "tsserver2.pid is missing, no started server ?" |
134 |
|
|
+ echo "No server running (ts3server.pid is missing)" |
135 |
|
|
exit 7 |
136 |
|
|
fi |
137 |
|
|
;; |
138 |
|
|
restart) |
139 |
|
|
- $0 stop && $0 start || exit 1 |
140 |
|
|
+ $0 stop && $0 start ${COMMANDLINE_PARAMETERS} || exit 1 |
141 |
|
|
;; |
142 |
|
|
status) |
143 |
|
|
- if [ -e $DIR/tsserver2.pid ]; then |
144 |
|
|
- echo "the server seems to be running" |
145 |
|
|
- exit 0 |
146 |
|
|
- else |
147 |
|
|
- echo "the server seems to be stopped" |
148 |
|
|
- exit 3 |
149 |
|
|
- fi |
150 |
|
|
- ;; |
151 |
|
|
- passwords) |
152 |
|
|
- if [ -e $DIR/server.log ]; then |
153 |
|
|
- date=$(cat $DIR/server.log | grep "admin account info: username: admin" | tail -n 1 | sed "s/^\([0-9]\+-[0-9]\+-[0-9]\+ [0-9]\+:[0-9]\+:[0-9]\+\).*$/\1/") |
154 |
|
|
- spass=$(cat $DIR/server.log | grep "superadmin account info: username: superadmin" | tail -n 1 | sed "s/^.*username: superadmin password: \([a-z0-9]\+\).*$/\1/") |
155 |
|
|
- pass=$(cat $DIR/server.log | grep "admin account info: username: admin" | tail -n 1 | sed "s/^.*username: admin password: \([a-z0-9]\+\).*$/\1/") |
156 |
|
|
- echo "Following passwords were generated on $date" |
157 |
|
|
- echo "superadmin = \"$spass\"" |
158 |
|
|
- echo "admin = \"$pass\"" |
159 |
|
|
+ if [ -e ts3server.pid ]; then |
160 |
|
|
+ if ( kill -0 $(cat ts3server.pid) 2> /dev/null ); then |
161 |
|
|
+ echo "Server is running" |
162 |
|
|
+ else |
163 |
|
|
+ echo "Server seems to have died" |
164 |
|
|
+ fi |
165 |
|
|
else |
166 |
|
|
- echo "server.log not found, maybe you did not start the server yet ?" |
167 |
|
|
- exit 1 |
168 |
|
|
+ echo "No server running (ts3server.pid is missing)" |
169 |
|
|
fi |
170 |
|
|
;; |
171 |
|
|
*) |
172 |
|
|
- echo "Usage: $0 {start|stop|restart|status|passwords}" |
173 |
|
|
+ echo "Usage: ${0} {start|stop|restart|status}" |
174 |
|
|
exit 2 |
175 |
|
|
esac |
176 |
|
|
exit 0 |