Sponsored Content
Full Discussion: Need Help With Quota Script
Top Forums UNIX for Dummies Questions & Answers Need Help With Quota Script Post 302308064 by Snoop180 on Friday 17th of April 2009 03:16:25 AM
Old 04-17-2009
Bug Need Help With Quota Script

Hi everyone

I'm really new to all this but i need help creating a script that will produce the following for each user when they log on using bash

You are currently using 91% of your quota
Consider reducing your usage
The 10 biggest directories in your home directory are:
Size Directory
---- ---------
112K .gconf
136K old-cs362.tgz
136K performance
376K bin
384K cs362
384K old-home.tgz
392K yallara.web.tgz
456K .newsrc
664K old-cs262.tgz
672K .tin


I have no idea how to start this so all help would be appreciated

Last edited by Snoop180; 04-17-2009 at 04:26 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Quota

I'm new to Unix and I'm trying to determin how much space I have on this system. the box is dedicated to Oracle and I log in as the oracle user and type quota. It retrunes nothing. Then I log on as root and type quota -v oracle.. It returns nothing! Gosh this is actually a solaris 5.7 box. ... (1 Reply)
Discussion started by: jarthda
1 Replies

2. HP-UX

Quota-problem

Hello, I'm having some trouble with the quota's I've set on our HP-UX B.11.00 U 9000/800. Well not really with the quota's because I was able to set them and get them working without a problem but the problem resides somewhere with our AS/U (Advanced Server for HP9000 Release B.04.06.07 and... (5 Replies)
Discussion started by: chrizz
5 Replies

3. UNIX for Dummies Questions & Answers

Quota Problem

Hi all! I'm a user of Debian Etch. I've problem with my accoun't quota. After I removed all of my files from my home directory, and typed: du -hs It showed me: 76K . But when I used quota command, it showed me: Disk quotas for user X (uid *********): Filesystem blocks quota ... (2 Replies)
Discussion started by: mjdousti
2 Replies

4. UNIX for Dummies Questions & Answers

Disk Quota

Hi all, I am new to Unix admin. Can anyone tell me how to set disk quota for the users in /export/home directory? Pls specify the exact command. Thanks (1 Reply)
Discussion started by: solaris5.10
1 Replies

5. Shell Programming and Scripting

allocate user quota using perl script

Hi I'm a student who is studying system administration. I need to write a perl script to allocate disk quota to users. I'm using ubuntu and When I try to run edquota command in command line it says that Can't find file system with quota. pls help me. I tried to edit fstab. but didn't work. ... (1 Reply)
Discussion started by: piumali
1 Replies

6. UNIX for Advanced & Expert Users

Quota threshold

Hi, I am trying to make a script in which the user is notified once the disk space of the environment increases a particular threshold. I have made a script for it but I am facing an error while executing it. Could any one here guide me further?? Script #!/bin/sh warninglimit=350000... (22 Replies)
Discussion started by: Taranjeet Singh
22 Replies

7. Red Hat

User quota

Hi, I want to apply the user quota, but i am unable to apply the quota to user. Kindly provide the guide line, so that i can sortout the problem. Step 1: Create partion on device #fdisk /dev/sda (because hard disk is scsi) #n (new partition table) i.e /dev/sda8. #p ( to print the partition... (2 Replies)
Discussion started by: sahu.tapan
2 Replies

8. Linux

CentOS 5.3 quota

I am running on CentOS 5.3 x86 64bit. I setup quotas on /home as I thought successfully, I tested numerous times with a couple of different users. I login this morning and find my /home near 100% wondering what happened. I have one user that some how blew through his 3.5 gig quota and... (1 Reply)
Discussion started by: beaker457
1 Replies

9. Windows & DOS: Issues & Discussions

quota script for windows XP

Hi I am Samba server which is working as a domain log on server for winxp client and user home directories are assigned 100MB quota on the linux drive. I am trying to get below script working so that user gets informed of his disk space usage. dim oFS, oFolder set oFS =... (0 Replies)
Discussion started by: upengan78
0 Replies

10. Red Hat

Setting quota

I would like to set quota for ALL USERS on a particular filesystem and the quota to be set for NEWLY CREATED USERS also. I am not sure, whether my question is clear. I can set quota for all users but my requirement is, I want the same quota to be set automatically for the user which is going... (2 Replies)
Discussion started by: atanubanerji
2 Replies
File::GlobMapper(3pm)					 Perl Programmers Reference Guide				     File::GlobMapper(3pm)

NAME
File::GlobMapper - Extend File Glob to Allow Input and Output Files SYNOPSIS
use File::GlobMapper qw( globmap ); my $aref = globmap $input => $output or die $File::GlobMapper::Error ; my $gm = new File::GlobMapper $input => $output or die $File::GlobMapper::Error ; DESCRIPTION
This module needs Perl5.005 or better. This module takes the existing "File::Glob" module as a starting point and extends it to allow new filenames to be derived from the files matched by "File::Glob". This can be useful when carrying out batch operations on multiple files that have both an input filename and output filename and the output file can be derived from the input filename. Examples of operations where this can be useful include, file renaming, file copying and file compression. Behind The Scenes To help explain what "File::GlobMapper" does, consider what code you would write if you wanted to rename all files in the current directory that ended in ".tar.gz" to ".tgz". So say these files are in the current directory alpha.tar.gz beta.tar.gz gamma.tar.gz and they need renamed to this alpha.tgz beta.tgz gamma.tgz Below is a possible implementation of a script to carry out the rename (error cases have been omitted) foreach my $old ( glob "*.tar.gz" ) { my $new = $old; $new =~ s#(.*).tar.gz$#$1.tgz# ; rename $old => $new or die "Cannot rename '$old' to '$new': $! ; } Notice that a file glob pattern "*.tar.gz" was used to match the ".tar.gz" files, then a fairly similar regular expression was used in the substitute to allow the new filename to be created. Given that the file glob is just a cut-down regular expression and that it has already done a lot of the hard work in pattern matching the filenames, wouldn't it be handy to be able to use the patterns in the fileglob to drive the new filename? Well, that's exactly what "File::GlobMapper" does. Here is same snippet of code rewritten using "globmap" for my $pair (globmap '<*.tar.gz>' => '<#1.tgz>' ) { my ($from, $to) = @$pair; rename $from => $to or die "Cannot rename '$old' to '$new': $! ; } So how does it work? Behind the scenes the "globmap" function does a combination of a file glob to match existing filenames followed by a substitute to create the new filenames. Notice how both parameters to "globmap" are strings that are delimited by <>. This is done to make them look more like file globs - it is just syntactic sugar, but it can be handy when you want the strings to be visually distinctive. The enclosing <> are optional, so you don't have to use them - in fact the first thing globmap will do is remove these delimiters if they are present. The first parameter to "globmap", "*.tar.gz", is an Input File Glob. Once the enclosing "< ... >" is removed, this is passed (more or less) unchanged to "File::Glob" to carry out a file match. Next the fileglob "*.tar.gz" is transformed behind the scenes into a full Perl regular expression, with the additional step of wrapping each transformed wildcard metacharacter sequence in parenthesis. In this case the input fileglob "*.tar.gz" will be transformed into this Perl regular expression ([^/]*).tar.gz Wrapping with parenthesis allows the wildcard parts of the Input File Glob to be referenced by the second parameter to "globmap", "#1.tgz", the Output File Glob. This parameter operates just like the replacement part of a substitute command. The difference is that the "#1" syntax is used to reference sub-patterns matched in the input fileglob, rather than the $1 syntax that is used with perl regular expressions. In this case "#1" is used to refer to the text matched by the "*" in the Input File Glob. This makes it easier to use this module where the parameters to "globmap" are typed at the command line. The final step involves passing each filename matched by the "*.tar.gz" file glob through the derived Perl regular expression in turn and expanding the output fileglob using it. The end result of all this is a list of pairs of filenames. By default that is what is returned by "globmap". In this example the data structure returned will look like this ( ['alpha.tar.gz' => 'alpha.tgz'], ['beta.tar.gz' => 'beta.tgz' ], ['gamma.tar.gz' => 'gamma.tgz'] ) Each pair is an array reference with two elements - namely the from filename, that "File::Glob" has matched, and a to filename that is derived from the from filename. Limitations "File::GlobMapper" has been kept simple deliberately, so it isn't intended to solve all filename mapping operations. Under the hood "File::Glob" (or for older versions of Perl, "File::BSDGlob") is used to match the files, so you will never have the flexibility of full Perl regular expression. Input File Glob The syntax for an Input FileGlob is identical to "File::Glob", except for the following 1. No nested {} 2. Whitespace does not delimit fileglobs. 3. The use of parenthesis can be used to capture parts of the input filename. 4. If an Input glob matches the same file more than once, only the first will be used. The syntax ~ ~user . Matches a literal '.'. Equivalent to the Perl regular expression . * Matches zero or more characters, except '/'. Equivalent to the Perl regular expression [^/]* ? Matches zero or one character, except '/'. Equivalent to the Perl regular expression [^/]? Backslash is used, as usual, to escape the next character. [] Character class. {,} Alternation () Capturing parenthesis that work just like perl Any other character it taken literally. Output File Glob The Output File Glob is a normal string, with 2 glob-like features. The first is the '*' metacharacter. This will be replaced by the complete filename matched by the input file glob. So *.c *.Z The second is Output FileGlobs take the "*" The "*" character will be replaced with the complete input filename. #1 Patterns of the form /#d/ will be replaced with the Returned Data EXAMPLES
A Rename script Below is a simple "rename" script that uses "globmap" to determine the source and destination filenames. use File::GlobMapper qw(globmap) ; use File::Copy; die "rename: Usage rename 'from' 'to' " unless @ARGV == 2 ; my $fromGlob = shift @ARGV; my $toGlob = shift @ARGV; my $pairs = globmap($fromGlob, $toGlob) or die $File::GlobMapper::Error; for my $pair (@$pairs) { my ($from, $to) = @$pair; move $from => $to ; } Here is an example that renames all c files to cpp. $ rename '*.c' '#1.cpp' A few example globmaps Below are a few examples of globmaps To copy all your .c file to a backup directory '</my/home/*.c>' '</my/backup/#1.c>' If you want to compress all '</my/home/*.[ch]>' '<*.gz>' To uncompress '</my/home/*.[ch].gz>' '</my/home/#1.#2>' SEE ALSO
File::Glob AUTHOR
The File::GlobMapper module was written by Paul Marquess, pmqs@cpan.org. COPYRIGHT AND LICENSE
Copyright (c) 2005 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-10-11 File::GlobMapper(3pm)
All times are GMT -4. The time now is 12:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy