Sponsored Content
Full Discussion: Unix space checking script
Homework and Emergencies Homework & Coursework Questions Unix space checking script Post 302494056 by krolike on Friday 4th of February 2011 04:34:19 PM
Old 02-04-2011
first of all thx a lot scottn Smilie your help if really great !!!
Your giving me confidence to continue trying to do this Smilie
So here is attempt number 3 I wrote that when waiting for a previous answer and don't want it to go to waste so here goes :

Assuming parameter '1' is a mount point and parameter '2' is a percent "free", then :

Code:
if [ -d "$1" ]; then
  FREE=$(df -k $1 | |awk 'NR==2{print 100-substr($5,1,length($5)-1);}')
  [ $FREE -le $2 ] && echo "Not enough space, ${FREE}% left"
else
  echo "Directory $1 does not exist"
fi

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

checking for a space in a file name

hi members... another new probs... i need to check all the zip files in the server and check for a space or "`" in the file name and if found need to remove them and form a zip file. i tried using grep command to check for a space but with out success also when i tried checking for "`" as... (6 Replies)
Discussion started by: madhu_aqua14
6 Replies

2. Shell Programming and Scripting

Checking availability of Web pages through Unix script

Hi Guru's, I need to check the availability of a web page for every one hour through a script. Following is the requirement. 1. Go to http://vsn.srivsn.com 2. If any error encountered in openeing the home page, it should trigger an email with the appropriate error message. 3. If page opens... (6 Replies)
Discussion started by: srivsn
6 Replies

3. UNIX for Dummies Questions & Answers

Problem in checking space of mount.Please help me

Hi everyone, I am writing a script. As a part of this script, I wanted to check the space of few mounts, If the space usage percentage of the mount crosses over a certain limit then i wanted to display a warning message. The following is the command df -k | awk ' { if (($6 == "/export/temp")... (4 Replies)
Discussion started by: Sheethal
4 Replies

4. Shell Programming and Scripting

Unix script for Checking sequence

Hello, I need Unix script for Checking sequence and get output in a file for missing sequences information. We are moving archive log to a server for DR .if any files miss from sequence DR will fails. so we need script to monitor sequence of files which are FTP from the Production servers .... (2 Replies)
Discussion started by: Rata_raj
2 Replies

5. Shell Programming and Scripting

Checking the space for /archlog mount point script

I have the below shell script which is checking /archlog mount point space on cappire(solaris 10) server. When the space usage is above 80% it should e-mail. When i tested this script it is working as expected. -------------------------------------------------------------------------... (0 Replies)
Discussion started by: dreams5617
0 Replies

6. UNIX for Advanced & Expert Users

Checking the space for /archlog mount point script

I have the below shell script which is checking /archlog mount point space on cappire(solaris 10) server. When the space usage is above 80% it should e-mail. When i tested this script it is working as expected. #!/usr/bin/ksh export MAIL_LIST="tlr.voora@zamn.com" export ARCH_STATUS=`df -k... (1 Reply)
Discussion started by: dreams5617
1 Replies

7. UNIX for Advanced & Expert Users

Checking missing data's sequence (shell script | UNIX command)

Dear All members, i have some trouble here, i want to ask your help. The case is: I have some data, it's like: -ABCD1234 -ABCD1235 -ABCD1237 -BCDE1111 -BCDE1112 -BCDE1114 there is some missing data's sequence (the format is: ABCD = name 1234 = sequence). I want to print the... (2 Replies)
Discussion started by: septian.tri
2 Replies

8. Solaris

UNIX Checking Tape Space

Hello. My name is Alex and I am new to the UNIX environment. One of the things that I do on a daily basis is I perform backups to tape on a Sun Ultra 25. I use DAT72 tape. The tape that is currently in the tape drive has about five database backups within it already. I was just hoping... (19 Replies)
Discussion started by: daddy.torres
19 Replies

9. Shell Programming and Scripting

Help needed to create a UNIX Space monitoring script

Hi All, Its urgent.. pls help me out.. I want to create a KSH which should generate a report with the list of users and the files larger than 5 GB created by them in a direcorty and send autogenerated e-mail to them. my input would be users list,directory path and the file size (say 5 GB) ... (11 Replies)
Discussion started by: anman0523
11 Replies

10. Shell Programming and Scripting

UNIX script to find alerts for swap space

Can someone get me script to find swap space for linux servers (1 Reply)
Discussion started by: Moon1234
1 Replies
LVREDUCE(8)						      System Manager's Manual						       LVREDUCE(8)

NAME
lvreduce - reduce the size of a logical volume SYNOPSIS
lvreduce [-A|--autobackup y|n] [-d|--debug] [-f|--force] [-h|-?|--help] {-l|--extents [-]LogicalExtentsNumber[%{VG|LV|FREE}] | -L|--size [-]LogicalVolumeSize[kKmMgGtT]} [-t|--test] [-v|--verbose] LogicalVolume[Path] DESCRIPTION
lvreduce allows you to reduce the size of a logical volume. Be careful when reducing a logical volume's size, because data in the reduced part is lost!!! You should therefore ensure that any filesystem on the volume is resized before running lvreduce so that the extents that are to be removed are not in use. Shrinking snapshot logical volumes (see lvcreate(8) for information to create snapshots) is supported as well. But to change the number of copies in a mirrored logical volume use lvconvert (8). Sizes will be rounded if necessary - for example, the volume size must be an exact number of extents and the size of a striped segment must be a multiple of the number of stripes. OPTIONS
See lvm for common options. -f, --force Force size reduction without any question. -l, --extents [-]LogicalExtentsNumber[%{VG|LV|FREE}] Reduce or set the logical volume size in units of logical extents. With the - sign the value will be subtracted from the logical volume's actual size and without it the will be taken as an absolute size. The number can also be expressed as a percentage of the total space in the Volume Group with the suffix %VG or relative to the existing size of the Logical Volume with the suffix %LV or as a percentage of the remaining free space in the Volume Group with the suffix %FREE. -L, --size [-]LogicalVolumeSize[kKmMgGtTpPeE] Reduce or set the logical volume size in units of megabyte by default. A size suffix of k for kilobyte, m for megabyte, g for giga- bytes, t for terabytes, p for petabytes or e for exabytes is optional. With the - sign the value will be subtracted from the logi- cal volume's actual size and without it it will be taken as an absolute size. Example "lvreduce -l -3 vg00/lvol1" reduces the size of logical volume lvol1 in volume group vg00 by 3 logical extents. SEE ALSO
lvchange(8), lvconvert(8), lvcreate(8), lvextend(8), lvm(8), lvresize(8), vgreduce(8) Sistina Software UK LVM TOOLS 2.02.44-cvs (02-17-09) LVREDUCE(8)
All times are GMT -4. The time now is 10:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy