-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgameserver.sh
More file actions
executable file
·131 lines (128 loc) · 2.79 KB
/
gameserver.sh
File metadata and controls
executable file
·131 lines (128 loc) · 2.79 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash
# CONFIGURADOR DE GAMESERVERS WEBTUGA by cenourinha
Principal() {
clear
echo "================================="
echo " _"
echo " | | _"
echo " _ _ _ _____| |__ _| |_ _ _ ____ _____"
echo "| | | | ___ | _ (_ _) | | |/ _ (____ |"
echo "| | | | ____| |_) )| |_| |_| ( (_| / ___ |"
echo " \___/|_____)____/ \__)____/ \___ \_____|"
echo " (_____|"
echo "================================="
echo "CONFIGURADOR DE GAMESERVERS WEBTUGA"
echo "------------------------------------------------- by cenourinha"
echo "Opções:"
echo
echo "1. Iniciar servidor"
echo "2. Parar servidor"
echo "3. Fazer Update ao servidor"
echo "4. Criar cliente"
echo "5. Sair"
echo
echo -n "Qual a opção desejada? "
read opcao
case $opcao in
1) Iniciar ;;
2) Parar ;;
3) Update ;;
4) CriarCliente ;;
5) clear; echo "Até logo!"; sleep 3s; clear; exit ;;
*) "Opção desconhecida." ; echo ; Principal ;;
esac
}
Iniciar() {
clear
echo -n "Iniciar uma GameServer"
echo
sleep 1s
clear
echo "Qual o cliente (username)?"
read user
clear
echo "Qual o nome do servidor?"
read nomeservidor
clear
echo Qual a porta?
read porta
clear
echo Quantas slots?
read slots
if [ $slots -lt 12 ]; then
clear
echo "Devera ter no minimo 12 slots"
read
Iniciar
fi
clear
echo Qual o mapa?
echo
echo "1. de_dust2"
echo "2. de_dust"
echo "3. cs_assault"
echo
read mapa
case $mapa in
1)
mapa="de_dust2";;
2)
mapa="de_dust";;
3)
mapa="cs_assault" ;;
*) clear; echo "Opção desconhecida." ; echo ; Iniciar ;;
esac
clear
cd /home/cs/$user
screen -r $user -X quit
screen -dmS $user ./hlds_run -game cstrike +ip 81.92.204.166 +port $porta +maxplayers $slots +exec server.cfg +map $mapa +hostname "$nomeservidor"
echo Servidor iniciado com sucesso!
}
Parar() {
clear
echo "Qual o cliente(username)?"
read user
clear
echo -n "Tem a certeza? [y/n] "
read var
if [ $var = "y" ]; then
screen -wipe
screen -r $user -X quit
clear
echo "Server parado com sucesso!"
sleep 2s
elif [ $var = "n" ]; then
Principal
fi
Principal
}
CriarCliente() {
clear
echo "Criar cliente"
sleep 1s
clear
echo "Qual username?"
read username
clear
echo "Qual a password?"
read password
clear
echo "Insira a password root"
su --command="useradd -d /home/cs/$username -s /usr/bin/rc -p $password -G cs -m -k /home/cs/server/ $username; chmod 777 /home/cs/$username; exit;" -
clear
echo "Cliente criado com sucesso"
sleep 2s
Principal
}
Update() {
clear
echo "Qual o cliente(username)?"
read user
clear
echo "A actualizar..."
./steam -command update -game cstrike -dir /home/$USER/$user
sleep 3s
echo "Actualizado com sucesso..."
clear
}
Principal