-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathuninstall.sh
154 lines (141 loc) · 5.42 KB
/
uninstall.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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
#
# Instrucciones en Español: https://gorobeta.blogspot.com
# Repositorio de GitHub: https://github.com/digiraldo/Minecraft-BE-Server-Panel-Admin-Web
# Colores del terminal
BLACK=$(tput setaf 0)
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
LIME_YELLOW=$(tput setaf 190)
BLUE=$(tput setaf 4)
MAGENTA=$(tput setaf 5)
CYAN=$(tput setaf 6)
WHITE=$(tput setaf 7)
BRIGHT=$(tput bold)
NORMAL=$(tput sgr0)
BLINK=$(tput blink)
REVERSE=$(tput smso)
UNDERLINE=$(tput smul)
# Imprime una línea con color usando códigos de terminal
Print_Style() {
printf "%s\n" "${2}$1${NORMAL}"
}
# Función para leer la entrada del usuario con un mensaje
function read_with_prompt {
variable_name="$1"
prompt="$2"
default="${3-}"
unset $variable_name
while [[ ! -n ${!variable_name} ]]; do
read -p "$prompt: " $variable_name < /dev/tty
if [ ! -n "`which xargs`" ]; then
declare -g $variable_name=$(echo "${!variable_name}" | xargs)
fi
declare -g $variable_name=$(echo "${!variable_name}" | head -n1 | awk '{print $1;}')
if [[ -z ${!variable_name} ]] && [[ -n "$default" ]] ; then
declare -g $variable_name=$default
fi
echo -n "$prompt : ${!variable_name} -- aceptar? (y/n)"
read answer < /dev/tty
if [ "$answer" == "${answer#[Yy]}" ]; then
unset $variable_name
else
echo "$prompt: ${!variable_name}"
fi
done
}
BackConfig=backub_config
cd ~
if [ ! -d "backub_config" ]; then
echo "El directorio ${BackConfig} no existe"
sudo mkdir backub_config
else
cd backub_config
echo "El directorio ${BackConfig} existe"
sleep 2s
Print_Style "===================SERVIDORES MONTADOS EN $BackConfig====================" "$CYAN"
ls -l
Print_Style "=========================================================================" "$CYAN"
sleep 6s
echo "========================================================================="
Print_Style "Sincronizando y haciendo respaldo a los archivos de configuración..." "$RED"
sleep 2s
sudo rsync -avz --include='*.json' --include='*.properties' --exclude='*' dirname/minecraftbe/servername/ dirname/backub_config
Print_Style "comprimiendo archivos de config..." "$RED"
sleep 2s
sudo zip -r dirname/backub_config/$(date +%Y.%m.%d_%H\:%M\:%S_Config_servername).zip dirname/minecraftbe/config
echo "========================================================================="
sleep 3s
fi
cd ~
echo "========================================================================="
Print_Style "Eliminando Servidor Minecraft" "$YELLOW"
sudo rm -rf minecraftbe
sudo rm -rf panel.sh
sudo rm -rf install.sh
sudo rm -rf SetupMinecraft.sh
echo "========================================================================="
Print_Style "Quitando libapache" "$MAGENTA"
sleep 2s
sudo apt-get purge --auto-remove libapache2-mod-php -y
echo "========================================================================="
Print_Style "Quitando Nginx" "$MAGENTA"
sleep 2s
sudo apt-get purge --auto-remove nginx -y
echo "========================================================================="
Print_Style "Quitando PHP" "$MAGENTA"
sleep 2s
sudo apt-get purge --auto-remove php-fpm -y
echo "========================================================================="
echo "========================================================================="
Print_Style "Buscando Version Apache" "$MAGENTA"
sleep 2s
sudo apache2 -v
echo "========================================================================="
sleep 3s
sudo systemctl stop apache2
Print_Style "Quitando Apache" "$MAGENTA"
sleep 2s
sudo apt remove apache2
sudo apt purge apache2
sudo apt-get --purge remove apache-common
sudo apt-get --purge remove apache
Print_Style "Eliminando Archivos de configuarcion de apache" "$BLUE"
sudo find /etc -name "*apache*" |xargs rm -rf
sudo rm -rf /var/www
sudo rm -rf /etc/libapache2-mod-jk
sudo rm -rf /etc/init.d/apache2
sudo rm -rf /etc/apache2
Print_Style "Eliminando Asociacion de apache" "$BLUE"
dpkg -l |grep apache2|awk '{print $2}'|xargs dpkg -P
Print_Style "Eliminando Svn" "$BLUE"
sudo apt-get remove subversion
sudo apt-get remove libapache2-svn
Print_Style "verificar, si no hay retorno" "$YELLOW"
dpkg -l | grep apache y dpkg -l | grep apache2
echo "========================================================================="
Print_Style "Borrando directorios y archivos" "$MAGENTA"
sleep 3s
sudo rm -rf minecraftbe
sudo rm -rf SetupMinecraft.sh
sudo rm -rf uninstall.sh
echo "========================================================================="
echo -n "¿Instalar Servidor Minecrft Bedrock? (y/n)"
read answer < /dev/tty
if [ "$answer" != "${answer#[Yy]}" ]; then
# Crear copia de seguridad en la nube cloudname
echo "========================================================================="
echo "Buscano Archivos de Instalación..."
echo "========================================================================="
sleep 3s
cd ~
wget https://raw.githubusercontent.com/digiraldo/Minecraft-BE-Server-Panel-Admin-Web/master/install.sh
chmod +x install.sh
./install.sh
#curl https://raw.githubusercontent.com/digiraldo/Minecraft-BE-Server-Panel-Admin-Web/master/install.sh | bash
#wget -O install.sh https://raw.githubusercontent.com/digiraldo/Minecraft-BE-Server-Panel-Admin-Web/master/install.sh
#sudo chmod +x install.sh
#/bin/bash install.sh
fi
sudo rm -rf uninstall.sh