Sponsored Content
Top Forums Shell Programming and Scripting Help with variables for filesystems allocated Post 302332576 by compan023 on Thursday 9th of July 2009 01:25:03 PM
Old 07-09-2009
Very new meaning that I have jumped into this with no background experience and am trying getting my feet wet. I'm pretty much learning as I go and seeing if this is a field i would like to pursue.

ok, i have rearranged the script a little bit. I have left in the comment for set -x because it seems that the information is a little more organized for me that way. This is what I have right now:

#!/bin/ksh
#set -x
df -m | grep -v ":"|grep -v Free|grep -v "/proc"| while read FSYSTEM BLKS FREE USED IUSED PERIUSED MOUNTEDON
HOST=`hostname`
do
(( INUSE = $BLKS - $FREE ))
echo $FSYSTEM $BLKS $FREE InUse= $INUSE $MOUNTEDON



This returns:
/dev/hd4 1024.00 966.48 InUse= 58 /
/dev/hd2 3392.00 288.55 InUse= 3104 /usr
/dev/hd9var 2048.00 1976.50 InUse= 72 /var
/dev/hd3 2048.00 1834.10 InUse= 214 /tmp
/dev/hd1 1536.00 698.94 InUse= 838 /home
/dev/hd10opt 1024.00 556.55 InUse= 468 /opt
/dev/fslv00 30720.00 13025.69 InUse= 17695 /aix52_save_s
/dev/fslv01 1024.00 1023.52 InUse= 1 /var/adm/perf
/dev/nmon_lv 1600.00 1584.06 InUse= 16 /nmondata
comnascript.ksh[6]: INUSE = - : 0403-053 Expression is not complete; more tokens expected.

Now my first question, is how would I be able to separate this info into easier to read columns. Also how can i add the titles as the first line?

A variable that i believe i have to use is something for the entire server. I would need to have the script calculate the totals from "InUse" and "FREE" and have that echo back at the end. I hope this makes sense and thank you for your time.
 

10 More Discussions You Might Find Interesting

1. Solaris

Memory allocated

Hi, How to find out what is the maximum memory allocated to TOMCAT server in SunOS 5.8? The Tomcat server crashes down during peak times.... Regards (1 Reply)
Discussion started by: baanprog
1 Replies

2. Solaris

xntpd[28781]: too many recvbufs allocated

Hi, I have a server that is getting the following alarm a couple times a day: Mar 25 10:56:54 hostname xntpd: too many recvbufs allocated (30) Mar 25 10:56:54 hostname xntpd: too many recvbufs allocated (30) I know this is some sort of NTP related issue but I need to gauge the severity of... (0 Replies)
Discussion started by: BrewDudeBob
0 Replies

3. Solaris

Can be changeed the allocated space

i am working with solaris 9 and my disk usages are # df -k Filesystem kbytes used avail capacity Mounted on /dev/dsk/c0t0d0s0 2148263 1902721 202577 91% / /proc 0 0 0 0% /proc mnttab 0 0 0 ... (3 Replies)
Discussion started by: smartgupta
3 Replies

4. Solaris

Increasing allocated space to a mount - possible?

Hey guys, I am somewhat new to Solaris - and very new when it comes to mounts. My problem is that when I installed Solaris, I allocated way too little diskspace to my / mount (it first became obvious now, however, because of new needs). bash-3.00# df -h Filesystem size ... (25 Replies)
Discussion started by: brightstorm
25 Replies

5. Programming

Dynamically allocated structures in C

I have a pointer to a structure containing an integer pointer: struct members { int id; int *neigh; }; The number of members N and its neighbors M change as the code runs, so I allocate the memory dynamically: members *grid = malloc(sizeof(members)*N); for(i=0;i<N;i++)... (2 Replies)
Discussion started by: brinch
2 Replies

6. Programming

Why memory allocated through malloc should be freed ?

Actually for a process to run it needs text, stack , heap and data segments. All these find a place in the physical memory. Out of these 4 only heap does exist after the termination of the process that created it. I want to know the exact reason why this happens. Also why the other process need to... (20 Replies)
Discussion started by: karthiktceit
20 Replies

7. UNIX for Dummies Questions & Answers

How to find the disk space allocated.

Hello, I need to find the total allocated disk space for the home directory. How can i find that in unix?(in GB). Thanks. (4 Replies)
Discussion started by: kailash19
4 Replies

8. Programming

find size of heap allocated

I want to find the size of the total memory allocated on the heap for the following statement: int* a = new int;How can I use the sizeof operator for this? I used: printf("\t===> %d\n",sizeof(*a)); Is this statement correct? I have asked the question because when I checked the memory of... (13 Replies)
Discussion started by: rupeshkp728
13 Replies

9. Shell Programming and Scripting

Shell script to sum up the space allocated to filesystems

Hi , I Would like to know the space allocated by adding up all the allocated space to group of filesystems .. example , df -h|grep /db | awk '{ print $4 }' ---> giving me all the used space on the filesystem but need to know the total used space by adding up all the values (3 Replies)
Discussion started by: nsankineni
3 Replies

10. UNIX for Beginners Questions & Answers

How to change allocated memory for a process?

Hello, I am running ubuntu 14.04 in a server with 32GB ram. Due to receiving "high load" errors during ssh connection, I took a look at what's happening from command line. I detected that 20GB of total memory was allocated to a program. Below you can see some initial part of installation... (4 Replies)
Discussion started by: baris35
4 Replies
virtual-filesystems(7)					 Miscellaneous Information Manual				    virtual-filesystems(7)

NAME
virtual-filesystems - event signalling that virtual filesystems have been mounted SYNOPSIS
virtual-filesystems [ENV]... DESCRIPTION
The virtual-filesystems event is generated by the mountall(8) daemon after it has mounted all virtual filesystems listed in fstab(5). mountall(8) emits this event as an informational signal, services and tasks started or stopped by this event will do so in parallel with other activity. This event is typically used by services that must be started in order to mount other filesystems. When this event occurs, common filesys- tems such as /usr may not be mounted. For most normal services the filesystem(7) event is sufficient. EXAMPLE
A service that wishes to be running once virtual filesystems are mounted might use: start on virtual-filesystems SEE ALSO
mounting(7) mounted(7) local-filesystems(7) remote-filesystems(7) all-swaps(7) filesystem(7) mountall 2009-12-21 virtual-filesystems(7)
All times are GMT -4. The time now is 08:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy