| 
					
				 | 
			
			
				@@ -475,6 +475,74 @@ instalarMariaDB() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+habilitarServicio() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	# Arrancamos y habilitamos el servicio (con SystemD, Upstart o SystemV) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	# Intentamos con systemctl (SystemD) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	printf "Habilitando servicio $1" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if [ $# -le 0 ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		printf "\nERROR:\tError interno (habilitar servicio).\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		exit 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	which systemctl > /dev/null 2>&1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if [ $? -eq 0 ]; then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		printf " (SystemD)..." 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		systemctl start $1 > /dev/null 2>&1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if [ $? -ne 0 ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			printf "\nERROR:\tImposible encender servicio '$1'.\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			exit 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		systemctl enable $1 > /dev/null 2>&1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if [ $? -ne 0 ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			printf "\nERROR:\tImposible habilitar servicio '$1' durante el arranque.\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			exit 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		# Intentamos con service (Upstart) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		which service > /dev/null 2>&1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if [ $? -eq 0 ]; then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			printf " (Upstart)..." 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			service $1 start > /dev/null 2>&1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if [ $? -ne 0 ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				printf "\nERROR:\tImposible encender el servicio '$1'.\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				exit 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			# Intentamos con init.d (SystemV) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			printf " (SystemV)..." 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			/etc/init.d/$1 start > /dev/null 2>&1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if [ $? -ne 0 ]; then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				printf "\nERROR:\tImposible encender el servicio '$1'.\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				exit 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		# Intentamos habilitar en el arranque (Upstart) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		which update-rc.d > /dev/null 2>&1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if [ $? -eq 0 ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			update-rc.d $1 enable 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if [ $? -ne 0 ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				printf "\nERROR:\tImposible habilitar servicio '$1' durante el arranque.\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				exit 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			# Intentamos habilitar en el arranque (SystemV) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			which chkconfig > /dev/null 2>&1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if [ $? -eq 0 ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				chkconfig $1 on 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if [ $? -ne 0 ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					printf "\nERROR:\tImposible habilitar servicio '$1' durante el arranque.\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					exit 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				# ¿Qué mas opciones nos quedan? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				printf "\nERROR:\tImposible habilitar servicio '$1' durante el arranque.\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				exit 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	# Comprobamos si el servicio está funcionando 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	printf " OK.\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # Comprobación del sistema e inicialización 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 comprobarRoot 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 inicializarVariables 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -536,8 +604,13 @@ mostrarExpress 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	# Configuración Apache 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		# Virtual Hosts 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	# Configuración Database 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		# Establecer Contrasñea y configuración Segura 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if [ $mySQLOn = true ] || [ $mariaDBOn = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		# Arrancar Base de Datos, establecer contraseña y configuración segura 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if [ $mySQLOn = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			habilitarServicio mysql 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			establecerSQLPasswd 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if [ $mariaDBOn = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			habilitarServicio mariadb 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			establecerSQLPasswd 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	# Configuración PHP 
			 |