Portal    Foro    Buscar    FAQ    Registrarse    Conectarse


Publicar nuevo tema  Responder al tema 
Página 1 de 1
 
 
Script bash para determinar configuración del sistema
Autor Mensaje
Responder citando   Descargar mensaje 
Mensaje Script bash para determinar configuración del sistema 
 
Extraído de la lista de correo gambas-users.

Genera un archivo de texto con información del sistema, como plataforma, kernel, RAM y versiones instaladas de gambas.
Es muy útil para conocer estos datos en caso de problemas. Para usarlo, descarga el código, guarda el archivo y dar permisos de ejecución.

#!/bin/bash

# System Report script for Gambas
# Joshua Higgins
# GPL'd

# Revision 10 26/08/09

OutputFile='gambas_report.log';

echo "System Report for gambas"

# ---------------- DETECT DISTRIBUTION VERSION

# Detection of following distro's is supported
# To add dectection of your favourite distro, format as follows:
# distroshortname:/path/to/version/file
# (generic:/etc/issue should be the LAST entry in the list, as this is the fallback)

distros="ubuntu:/etc/lsb-release vector:/etc/vector-version slackware:/etc/slackware-version debian:/etc/debian_version redhat:/etc/redhat-release arch:/etc/arch-release SuSE:/etc/SuSE-release gentoo:/etc/gentoo-release conectiva:/etc/conectiva-release mandriva:/etc/mandriva-release mandrake:/etc/mandrake-release pardus:/etc/pardus-release kanotix:/etc/kanotix-release generic-undetected:/etc/issue"

for distro in $distros
do

path="`echo $distro  | awk -F: '{print $2}'`"
vendor="`echo $distro | awk -F: '{print $1}'`"

# Ubuntu gives an lsb-release file, which needs the info extracting from

if [ "$vendor" = "ubuntu" ]; then
release="`cat $path 2>/dev/null | grep DESCRIPTION | awk -F= '{print $2}'`"
else
release="`cat $path 2>/dev/null`"
fi

        if [ "$release" = "" ]; then
        message="Still not here..."
                # Check if we've missed Arch
                if [ -e /etc/arch-release ]; then
                vendor="arch"
                release="n/a"
                echo "Detected distro: $vendor"
                break
                fi
        else
        echo "Found distro information at $path!"
        echo "Detected distro: $vendor"
        break
        fi
done

# ---------------- DETECT OS DETAILS

OS=$(uname)
KERNEL=$(uname -r)

# ---------------- DETECT SYSTEM DETAILS


if [ "$OS" = "FreeBSD" ]; then

# Added for FreeBSD RAM detection

RAM=$(echo `sysctl -n hw.physmem` / 1024 | bc -l | cut -d . -f1)" Kb"
else
RAM="`cat /proc/meminfo | grep MemTotal | awk -F: '{print $2}' | sed -e 's/^[ \t]*//'`"
fi

ARCH=$(uname -m)

# ---------------- DETECT gambas DETAILS

GAMBAS=$(gbx -V 2>/dev/null)
GAMBAS2=$(gbx2 -V 2>/dev/null)
GAMBAS3=$(gbx3 -V 2>/dev/null)

GAMBASPATH=$(which gbx 2>/dev/null)
GAMBAS2PATH=$(which gbx2 2>/dev/null)
GAMBAS3PATH=$(which gbx3 2>/dev/null)

# ---------------- PRINT ALL TO FILE

echo "[OperatingSystem]" > $OutputFile
echo "OperatingSystem=$OS" >> $OutputFile
echo "KernelRelease=$KERNEL" >> $OutputFile
echo "DistributionVendor=$vendor" >> $OutputFile
echo "DistributionRelease=$release" >> $OutputFile
echo "" >> $OutputFile
echo "[System]" >> $OutputFile
echo "CPUArchitecture=$ARCH" >> $OutputFile
echo "TotalRam=$RAM" >> $OutputFile
echo "" >> $OutputFile
echo "[gambas]" >> $OutputFile

if [ "$GAMBAS" = "" ]; then
echo "Gambas1=Not Installed" >> $OutputFile
else
echo "Gambas1=$GAMBAS" >> $OutputFile
echo "Gambas1Path=$GAMBASPATH" >> $OutputFile
fi

if [ "$GAMBAS2" = "" ]; then
echo "Gambas2=Not Installed" >> $OutputFile
else
echo "Gambas2=$GAMBAS2" >> $OutputFile
echo "Gambas2Path=$GAMBAS2PATH" >> $OutputFile
fi

if [ "$GAMBAS3" = "" ]; then
echo "Gambas3=Not Installed" >> $OutputFile
else
echo "Gambas3=$GAMBAS3" >> $OutputFile
echo "Gambas3Path=$GAMBAS3PATH" >> $OutputFile
fi



echo "Saved to $OutputFile"
echo "Done."
 


Saludos
 




===================
Jesús Guardón

Por favor, usemos el corrector ortográfico antes de pulsar el botón "Enviar".

"uo ǝs ʇɐu pıɟıɔıן ɐdɹǝupǝɹ ɐ dɹoƃɹɐɯɐɹ, soןo ɥɐʎ bnǝ dɹodouǝɹsǝןo"
 
jguardon - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Mostrar mensajes anteriores:    
 
OcultarTemas parecidos
Tema Autor Foro Respuestas último mensaje
No hay nuevos mensajes Información del sistema jguardon General 1 Jueves, 17 Septiembre 2009, 21:54 Ver último mensaje
CanihoJR
No hay nuevos mensajes Llamadas a scripts bash desde Gambas gadolinio Shell Scripting 6 Sabado, 10 Abril 2010, 23:50 Ver último mensaje
gadolinio
No hay nuevos mensajes Añadido soporte para XML y SQL para resal... jguardon General 0 Viernes, 06 Agosto 2010, 19:31 Ver último mensaje
jguardon
No hay nuevos mensajes Creación de un sistema de ventas Torrealba2719 General 6 Miercoles, 04 Octobre 2017, 00:44 Ver último mensaje
Torrealba2719
 

Publicar nuevo tema  Responder al tema  Página 1 de 1
 

Usuarios navegando en este tema: 0 registrados, 0 ocultos y 1 invitado
Usuarios registrados conectados: Ninguno


 
Lista de permisos
No puede crear mensajes
No puede responder temas
No puede editar sus mensajes
No puede borrar sus mensajes
No puede votar en encuestas
No puede adjuntar archivos
Puede descargar archivos
No puede publicar eventos en el calendario



  

 

cron