Sponsored Content
Top Forums Shell Programming and Scripting ShellScript that emails you size of dir Post 302296346 by ce9888 on Wednesday 11th of March 2009 01:48:56 AM
Old 03-11-2009
You can start with something like this.

Of course this script need to be run with sudo or under root

Code:
#!/bin/ksh

MAXSIZE=50
USERID_BOUNDARY=1000 # normaly regular userid start at a certain number, low userid habitualy are reserved for the system and applications
IFS=":"

while read username two userid groupid five homedir rest
do
    if [ "$userid" -gt "$USERID_BOUNDARY" ] ; then
       MAILADRES="$username@server.com"
       if [ "du -sm $homedir | cut -f 1" > "$MAXSIZE" ] ; then
           echo "$homedir too big" | /usr/sbin/sendmail $MAILADRES
           echo "test";
       fi
    fi
done < /etc/passwd

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

a script to clone a dir tree, & overwrite the dir struct elsewhere?

hi all, i'm looking for a bash or tcsh script that will clone an empty dir tree 'over' another tree ... specifically, i'd like to: (1) specify a src directory (2) list the directory tree/hiearchy beneath that src dir, w/o files -- just the dirs (3) clone that same, empty dir hierarchy to... (2 Replies)
Discussion started by: OpenMacNews
2 Replies

2. Shell Programming and Scripting

How to check the file size in a dir

Hi all, I need to check the size of all files in a DIR.Can any one help me out from this? This is my code: filenames=`ls -l | cut -c 55-90` for f in $filenames do if then echo $f done Output: file access denied. *files have read permission alone. (6 Replies)
Discussion started by: bsathishmca
6 Replies

3. Shell Programming and Scripting

to write a script to compare the file size in the current directory and previous dir

hi, i am new to this site. i want to write a script to compare the file size of the files in the current dir with the files in the previous directory. the files name will be same, but the filename format will be as xyzddddyymm.txt. the files will arrive with the month end date(i want to... (5 Replies)
Discussion started by: tweety
5 Replies

4. Shell Programming and Scripting

Shellscript to find duplicates according to size

I have a folder which in turn has numerous sub folders all containing pdf files with same file named in different ways. So I need a script if it can be written to find and print the duplicate files (That is files with same size) along with the respective paths. So I assume here that same file... (5 Replies)
Discussion started by: deaddevil
5 Replies

5. Shell Programming and Scripting

A script to find dir, delete files in, and then del dir?

Hello!! I have directories from 2008, with files in them. I want to create a script that will find the directoried from 2008 (example directory: drwxr-xr-x 2 isplan users 1024 Nov 21 2008 FILES_112108), delete the files within those directories and then delete the directories... (3 Replies)
Discussion started by: bigben1220
3 Replies

6. Shell Programming and Scripting

Find which dir is big size in a directory

Hi all, Could you please tellme the commadn which sorts the list of directories in a parent dir by their size. Thanks. (2 Replies)
Discussion started by: firestar
2 Replies

7. UNIX for Dummies Questions & Answers

How to list all files in dir and sub-dir's recursively along with file size?

I am very new to unix as well as shell scripting. I have to write a script for the following requirement. In have to list all the files in directory and its sub directories along with file path and size of the file Please help me in this regard and many thanks in advance. (3 Replies)
Discussion started by: nmakkena
3 Replies

8. Shell Programming and Scripting

File size and dir size

How to use 'df' only to get the 'Available' space for a specific dir, and then compare with a specific file size using stat -c %s file.txt to see if the file actually can be copied into the dir. Is there any quick way to see if a file can fit into a dir? (4 Replies)
Discussion started by: Emilywu
4 Replies

9. UNIX for Advanced & Expert Users

Delimit the Folder Size come under Webapps dir

Hi all, Great thanks to all for support till today..today i came here for 1 new issue :-( in our organization we are developing a job portal web application for a client. using Apache-tomcat we are hosting this application, now i need to delimit the applications directory comer under the webapps... (1 Reply)
Discussion started by: anishkumarv
1 Replies

10. AIX

Assign read write permission to the user for specific dir and it's sub dir and files in AIX

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. I do not want to assign user the same group of that directories too.... (0 Replies)
Discussion started by: blinkingdan
0 Replies
AUTH_GETUSERINFO(3)					      Double Precision, Inc.					       AUTH_GETUSERINFO(3)

NAME
auth_getuserinfo - Obtain account information SYNOPSIS
#include <courierauth.h> int rc=auth_getuserinfo(const char *userid, int (*callback_func)(struct authinfo *, void *), void *callback_arg); DESCRIPTION
If userid is a valid account name, retrieve the account particulars and invoke callback_func. RETURNS
callback_func will be invoked if userid exists, and callback_func's return value becomes the return value from auth_getuserinfo (which should be 0, by convention). callback_func will not be invoked if an error occurs, which is reported by a non-zero return value from auth_getuserinfo. By convention, a positive return value indicates an internal, temporary failure, such as the authentication daemon process not running; a negative return value indicates that this request was processed, but it failed (probably because userid does not exist. The second argument to callback_func will be callback_arg, which is not interpreted by this function in any way. The first argument will be a pointer to the following structure: Example 1. struct authinfo struct authinfo { const char *sysusername; const uid_t *sysuserid; gid_t sysgroupid; const char *homedir; const char *address; const char *fullname; const char *maildir; const char *quota; const char *passwd; const char *clearpasswd; const char *options; } ; Description of the above fields: address The authenticated login ID. sysusername The authenticated account's userid and groupid can be looked up in the password file using address. If this field is NULL, obtain the userid and the groupid from sysuserid and sysgroupid. sysuserid sysuserid may be NULL if sysusername is initialized, otherwise it's a pointer to the account's numeric userid. sysgroupid Account's numeric groupid. sysgroupid is only used when sysusername is NULL. fullname This is the account's full name. This field is optional, it may be NULL. homedir The account's home directory. This field cannot be NULL. maildir The pathname to the account's mailbox. This field is optional, it can be NULL in which case the default location is assumed. quota Optional maildir quota on the account's mailbox (and NULL if no quota is set). passwd The account's encrypted password, if available. If the account has a cleartext password defined, this field can be set to NULL. The encrypted password can take several formats: o A traditional triple-DES crypted password, or a MD5+salt-hashed password, as used in Linux. o "{MD5}" followed by a base64-encoded MD5 hash of the password. o "{SHA}" followed by a base64-encoded SHA1 hash of the password. clearpasswd The account's cleartext password, if available. If the account has an encrypted password defined, this field can be set to NULL. options A comma-separated list of miscellaneous account options. See below for more information. Account options Depending on the configuration of the Courier authentication library, accounts may have individual options associated with them. If the authentication library configuration does not implement account options, the option string will be NULL. Otherwise it will be a comma-separated list of "option=value" settings. Note This is the account option implementation that's used by Courier, Courier-IMAP, and SqWebMail packages. Some of the following information is obviously not applicable for a particular package. The inapplicable bits should be obvious. The following options are recognized by the various Courier packages: Note The application is responsible for enforcing all the "disabled" option. An authentication request for service "imap", for example, will succeed provided that the userid and the password are valid, even if "disableimap=1" is set. The application's callback_func should check for this condition, and return a negative return code. disableimap=n If "n" is 1, IMAP access to this account should be disabled. disablepop3=n If "n" is 1, POP3 access to this account should be disabled. disablewebmail=n If "n" is 1, webmail access to this account should be disabled. disableshared=n If "n" is 1, this account should not have access to shared folders or be able to share its own folders with other people. group=name This account is a member of access group name. Instead of granting access rights on individual mail folders to individual accounts, the access rights can be granted to an access group "name", and all members of this group get the specified access rights. The access group name "administrators" is a reserved group. All accounts in the administrators group automatically receive all rights to all accessible folders. Note This option may be specified multiple times to specify that the account belongs to multiple account groups. sharedgroup=name Append "name" to the name of the top level virtual shared folder index file. This setting restricts which virtual shared folders this account could possibly access (and that's on top of whatever else the access control lists say). See the virtual shared folder documentation for more information. For technical reasons, group names may not include comma, tab, "/" or "|" characters. SEE ALSO
authlib(3)[1], auth_generic(3)[2], auth_login(3)[3], auth_enumerate(3)[4], auth_passwd(3)[5], auth_getoption(3)[6]. NOTES
1. authlib(3) authlib.html 2. auth_generic(3) auth_generic.html 3. auth_login(3) auth_login.html 4. auth_enumerate(3) auth_enumerate.html 5. auth_passwd(3) auth_passwd.html 6. auth_getoption(3) auth_getoption.html Double Precision, Inc. 08/23/2008 AUTH_GETUSERINFO(3)
All times are GMT -4. The time now is 04:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy