实现一个 实验环境信息报告 脚本

sh/bash/dash/ksh/zsh等Shell脚本
回复
EricFisher
帖子: 13
注册时间: 2008-12-17 15:55

实现一个 实验环境信息报告 脚本

#1

帖子 EricFisher » 2009-01-14 13:27

我想写一个脚本,在做实验测试时,可以用来自动生成实验环境信息。现在只是用到了uname, cpuinfo, meminfo,大家给点建议。

比如,cpuinfo和meminfo的信息是否可以再缩减些,如何缩减?
还有其它什么信息需要提供的?

#! /bin/sh

# eei_report -- experiment environment information report

# Copyright 2009 Free Software Foundation, Inc.
# Written by Eric Fisher <joefoxreal@gmail.com>.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.

operating_system=`uname -o 2>/dev/null`
kernel_name=`uname -s 2>/dev/null`
kernel_release=`uname -r 2>/dev/null`

machine=`uname -m 2>/dev/null`
processor=`uname -p 2>/dev/null`
hardware_platform=`uname -i 2>/dev/null`

user=`echo $USER`
date=`date`

echo "Experiment Environment Information Reprot"
echo "-----------------------------------------"
echo
echo "user: ${user}"
echo "date: ${date}"
echo
echo "uname info"
echo "-----------------------------------------"
echo "operating_system: ${operating_system}"
echo "kernel_name: ${kernel_name}"
echo "kernel_release: ${kernel_release}"
echo "machine: ${machine}"
echo "processor: ${processor}"
echo "hardware_platform: ${hardware_platform}"
echo
echo "cpu info"
echo "-----------------------------------------"
cat /proc/cpuinfo
echo "mem info"
echo "-----------------------------------------"
cat /proc/meminfo
头像
lerosua
论坛版主
帖子: 8455
注册时间: 2007-11-29 9:41
联系:

Re: 实现一个 实验环境信息报告 脚本

#2

帖子 lerosua » 2009-01-16 17:04

gcc/g++版本吧
回复