Sponsored Content
Full Discussion: my system configuration
Top Forums Shell Programming and Scripting my system configuration Post 302557579 by Corona688 on Wednesday 21st of September 2011 03:33:07 PM
Old 09-21-2011
Some comments:

1) We often get the "linux newbie memory freakout" here. A new user may see "56M free" and panic -- rebooting obsessively when free gets low, plugging bizzare and harmful values into /proc/vm to "flush the cache", and sometimes even reformatting just to try and solve an imaginary memory leak. Any decently busy system converts 'free' to 'cache' in short order, which is fine -- cache is as good as free.

2) It'd be better to leave dmidecode out than demand random people run your untested script as root.

3) Run ifconfig with the full path, /sbin/ifconfig, so non-root users can find it.

4) Not everyone has java. Test if java exists before trying to get its version.

5) You can get disk information without root and fdisk, as well as tons of other stuff, via /sys:
Code:
# Sizes and models of all hard drives
TOTAL=0
for X in /sys/class/block/[sh]d[a-z]
do
        D=$(basename ${X})
        read TYPE < ${X}/removable
        read SIZE < ${X}/size
        read MODEL <"${X}/device/model"
        [ "$TYPE" = 0 ] || continue # Ignore removable drives
        set -- ${X}[1-9]* # Set $# to the number of partitions

        TOTAL=$((TOTAL + SIZE))
        echo "$D[1-$#]: $(((SIZE*512)/(1000*1000*1000)))GB $MODEL"
done

echo "Total: $(( (TOTAL*512)/(1000*1000*1000) )) GB"

# MAC addresses of all network cards
for DEV in /sys/class/net/*
do
        D=`basename $DEV`
        [ "$D" = "lo" ] && continue # Ignore loopback
        [ "$D" = "sit0" ] && continue # Ignore ipv6 tunnel

        read MAC < $DEV/address
        echo "$D mac $MAC"
done

# Get some DMI information without needing root
cat /sys/class/dmi/id/* 2>/dev/null


Last edited by Corona688; 09-21-2011 at 04:47 PM..
This User Gave Thanks to Corona688 For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to the configuration of the system

How to know configuration information of the system. like (1) memory assigned for RAM - ? (2) How much is the Hard disk -? (3) processor I used uname and du -k commands. But i couldn't get information about RAM. which command gives this info (3 Replies)
Discussion started by: ds_sastry
3 Replies

2. UNIX for Dummies Questions & Answers

System boot configuration

On my PC I have two hard disks, the first with Windows 98 SE and the second with Linux Mandrake 8.0 (Traktopel). When I have installed Linux, it has modified the boot record of the 1st HD and it has added a graphic menu (LILO) for selecting the OS to use. By default, if I don't press a key, Linux... (2 Replies)
Discussion started by: robotronic
2 Replies

3. UNIX for Dummies Questions & Answers

Gathering system configuration

Hi there, I have been asked to write a script that gathers enough information on our Sun Solaris machines to be able to rebuild and configure them if they should go pop. My question is does anybody have any suggestions on the files that I need to take a copy of, to ensure that everything is... (4 Replies)
Discussion started by: hcclnoodles
4 Replies

4. Shell Programming and Scripting

System Configuration Extraction

Hi All, Im trying to extract a bunch of systems configuration. I have created a file called data.txt and used the below scripts to run extraction of data. Content of data.txt: /etc/passwd /etc/shadow /etc/cron.allow On the Linux terminal, I entered the following commands to execute my... (4 Replies)
Discussion started by: nerd
4 Replies

5. UNIX for Advanced & Expert Users

Script to get system configuration

Hi, We have >1000 UNIX boxes in our environment with various UNIX flavors like Solaris, HP-UX and Redhat Linux ES 3/4/5. We need to collect their system configuration like - No. of CPUs and their frequencies - RAM Size - No. of HDDs installed and their usage - Exact OS Version and its... (3 Replies)
Discussion started by: prvnrk
3 Replies

6. Shell Programming and Scripting

To check the system configuration on Sun solaris

Hi, Could you pls. let me know what is cammand in unix to check the system configuration on Sun solaris. Thanks in advance. Cheers (2 Replies)
Discussion started by: krackjack
2 Replies

7. Solaris

system configuration

how to identify if the machine is sun4u ? is this model a sun4u machine ? Model : Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 300MHz), (2 Replies)
Discussion started by: sudhiroracle
2 Replies

8. Shell Programming and Scripting

Wich tool for check that two system have the same configuration

Hello , On a couple of system I have to check that systems have the same configuration. This system are part of manual cluster but when application are going to switch from one side to another side I would like to be sure I am not going to experience incidents. It is why I wonder if on the web... (2 Replies)
Discussion started by: xavier38450
2 Replies
RAM(4)							     Kernel Interfaces Manual							    RAM(4)

NAME
ram - ram disk driver SYNOPSIS
/sys/conf/SYSTEM: NRAM ram_size # RAM disk size (512-byte blocks) major device number(s): block: 3 minor device encoding: must be zero (0) DESCRIPTION
The ram pseudo-device provides a very fast extended memory store. It's use is intended for file systems like /tmp and applications which need to access a reasonably large amount of data quickly. The amount of memory dedicated to the ram device is controlled by the NRAM definition in units of 512-byte blocks. This is also patchable in the system binary through the variable ram_size (though a patched system would have to be rebooted before any change took effect; see adb(1)). This makes it easy to test the effects of different ram disk sizes on system performance. It's important to note that any space given to the ram device is permanently allocated at system boot time. Dedicating too much memory can adversely affect system performance by forcing the system to swap heavily as in a memory poor environment. The block file accesses the ram disk via the system's buffering mechanism through a buffer sharing arrangement with the buffer cache. It may be read and written without regard to physical disk records. There is no `raw' interface since no speed advantage is gained by such an interface with the ram disk. DISK SUPPORT
The ram driver does not support pseudo-disks (partitions). The special files refer to the entire `drive' as a single sequentially addressed file. A typical use for the ram disk would be to mount /tmp on it. Note that if this arrangement is recorded in /etc/fstab then /etc/rc will have to be modified slightly to do a mkfs(8) on the ram disk before the standard file system checks are done. FILES
/dev/ram block file /dev/MAKEDEV script to create special files /dev/MAKEDEV.local script to localize special files SEE ALSO
hk(4), ra(4), rl(4), rk(4), rp(4), rx(4), si(4), xp(4) dtab(5), autoconfig(8) DIAGNOSTICS
ram: no space. There is not enough memory to allocate the space needed by the ram disk. The ram disk is disabled. Any attempts to access it will return an error. ram: not allocated. No memory was allocated to the ram disk and an attempt was made to open it. Either not enough memory was available at boot time or the kernel variable ram_size was set to zero. BUGS
The ram driver is only available under 2.11BSD. 3rd Berkeley Distribution Januray 27, 1996 RAM(4)
All times are GMT -4. The time now is 05:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy