-
Notifications
You must be signed in to change notification settings - Fork 0
/
teamspeak.sh
83 lines (68 loc) · 2.13 KB
/
teamspeak.sh
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
#
## Tech and Me ## - ©2016, https://www.techandme.se/
#
#PID_TS=(ps -ef | grep "teamspeak3" | awk '{print $2}')
# Add user
NEWUSER=teamspeak3
adduser --disabled-password --gecos "" "$NEWUSER"
usermod -s /sbin/nologin "$NEWUSER"
# Get Teamspeak
wget http://dl.4players.de/ts/releases/3.1.0/teamspeak3-server_linux_amd64-3.1.0.tar.bz2
# Unpack Teamspeak
tar jxf teamspeak3-server_linux_amd64-3.1.0.tar.bz2
# Move to correct directory
cd teamspeak3-server_linux_amd64 && mv * /home/$NEWUSER && cd .. && rm -rf teamspeak3*
touch /home/$NEWUSER/.ts3server_license_accepted
# Set ownership
chown -R $NEWUSER:$NEWUSER /home/$NEWUSER
# Add service
cat << TEAMSPEAK3 > "/lib/systemd/system/teamspeak.service"
[Unit]
Description=TeamSpeak 3 Server
After=network.target
[Service]
WorkingDirectory=/home/$NEWUSER
User=$NEWUSER
Group=$NEWUSER
Type=forking
ExecStart=/home/$NEWUSER/ts3server_startscript.sh start inifile=ts3server.ini
ExecStop=/home/$NEWUSER/ts3server_startscript.sh stop
PIDFile=/home/$NEWUSER/ts3server.pid
RestartSec=15
Restart=always
[Install]
WantedBy=multi-user.target
TEAMSPEAK3
systemctl --system daemon-reload
systemctl enable teamspeak.service
systemctl start teamspeak.service
systemctl status teamspeak.service
echo "Waiting while servertoken is generated..."
while true; do
if [ ! -z $(cd /home/$NEWUSER/logs && grep -r "token" | awk '{ print $5 }' | cut -d "=" -f 2) ]
then
break
fi
done
msg_box() {
local PROMPT="$1"
whiptail --msgbox "${PROMPT}" "$WT_HEIGHT" "$WT_WIDTH"
}
msg_box "TeamSpeak is now installed and enabled.
ServerAdmin privilege key created, please use it to gain
serveradmin rights for your virtualserver. Please also
check the /home/$NEWUSER/doc/privilegekey_guide.txt for details.
Please copy the SERVERTOKEN key to a safe location:
SERVERTOKEN = $(cd /home/$NEWUSER/logs && grep -r "token" | awk '{ print $5 }' | cut -d "=" -f 2)
You login information below:
LOGIN = serveradmin
PASSWORD = Please see this site on how to set a password: https://goo.gl/5rahB2"
any_key() {
local PROMPT="$@"
read -r -p "$(printf "${PROMPT}")" -n1 -s
echo
}
any_key Press any key to reboot...
echo -e "\e[32m"
reboot