-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSRV_COS_05_DISK_PART.sh
executable file
·68 lines (49 loc) · 1.85 KB
/
SRV_COS_05_DISK_PART.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
#!/bin/bash
echo
echo ##########################
echo # Creado por: gomgardav #
echo # [ David Gómez García ] #
echo ##########################
echo
log=./srv_cos_05_salida.sal
cd ~/samba || exit
# source ./00_00_VAR.sh
Menu () {
SalidaMenu=$(whiptail --title "Script 05" \
--menu "Selecciona una Opción" 13 35 5 \
1 "Actualizar" \
2 "Generar History" \
3 "Ejecutar Script" \
4 "Reiniciar" \
0 "Salir" 3>&1 1>&2 2>&3)
EstadoSalidaMenu=$?
}
EstadoSalidaMenu=0
while [ "$EstadoSalidaMenu" = 0 ]; do
Menu
Exit=no
case "$SalidaMenu" in
1 ) yum update -y && ym upgrade -y;;
2 ) HISTFILE=~/.bash_history && set -o history && history > ./srv_cos_05-history_"$(date +%F_%H-%M-%S)".his && history -c && set +o history && HISTFILE="";;
3 ) cfdisk /dev/sdb
mkfs.ext4 -L Usuarios /dev/sdb1
mkfs.ext4 -L Comun /dev/sdb2
Enter="Enter"
while [ -n "$Enter" ]; do
echo
read -p "Pulsa Enter para Continuar..." Enter
done
HISTFILE=~/.bash_history && set -o history && history > ./srv_cos_05-history_"$(date +%F_%H-%M-%S)".his && history -c && set +o history && HISTFILE="";;
4 ) reboot; exit;;
0 ) Exit=yes; break;;
* ) echo "Error en el Script !!!";;
esac
done
clear
if [ "$Exit" = "yes" ] && [ "$EstadoSalidaMenu" = "0" ]; then
echo "Has Salido Correctamente !"
elif [ "$EstadoSalidaMenu" = "1" ]; then
echo "Has seleccionado Cancelar !"
else
echo "Ha habido un Error !!!"
fi