Script to monitor directory size of specific users


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to monitor directory size of specific users
# 1  
Old 03-20-2012
Script to monitor directory size of specific users

Hi,

i am new to shell scripts, i need to write a script that can monitor size of directory of specific users. Please help.

Thanks,
Nitin
# 2  
Old 03-20-2012
The user's home directory can be definitively found in /etc/passwd.

The du -hs $DIRECTORY command will tell you the size of that directory.

the crontab -e launches an editor and allows you edit the cron table to schedule tasks.

Your script could be run under cron and forward an email using sendmail if any user is above a specified limit.

I suggest having a go at the script outlined above reading the man pages for the tools outlined and then letting us know if you hit any difficulties.
# 3  
Old 03-20-2012
monitor size of directories

Hi Skrynesaver,

Thanks for the reply. i want to write script which can display the directories created by the specific user and the size of the directory. for e.g if we give ls -ltr command it shows something like this~
ls -ltr
-rw-r--r-- 1 abc eng 396 Jun 13 2012 xyz
-rwxr-xr-x 1 def eng 202 Aug 15 2012 pqr
-rwxr-xr-x 1 ghi eng 201 Aug 15 2012 stu

Now i want to write a script which can monitor size used by users abc,def and ghi to create directories xyz,pqr and stu
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell scripting-I need a script which should watch a directory for a file with specific directory

I need a script which should watch a directory for a file with specific directory. If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column. The file should be moved to another directory and the a... (8 Replies)
Discussion started by: akashdeepak
8 Replies

2. Shell Programming and Scripting

awk to monitor size in directory

i'm trying to find the most efficient way to monitor specific files in different directories in one go. /var/log/ /var/app/ /var/db/ each one of these directories can have subdirectories which need to be looked into as well. I want to find any file in this directory that has the name... (7 Replies)
Discussion started by: SkySmart
7 Replies

3. Shell Programming and Scripting

Script to monitor for new file with ext .err and size > 0 bytes and perform a action or command

Hi All, I need to create a script to monitor a dir for new files with ext .err and also it should b a non empty files. and perform a action or command . We have a new ETL application that runs on a linux server, every times a etl fails it creates a .err file or updates the existing .err... (4 Replies)
Discussion started by: MAKHAN
4 Replies

4. UNIX for Dummies Questions & Answers

Creating directory with specific size?

Hello world, I just learnt we can create a directory with custom size in a Linux server (say Redhat). Is it true? I'm asking because the only data (I can think of) a directory's inode holds is the files and 'sub-dir's. How can a new empty directory be of some required size? :wall: PS : In... (2 Replies)
Discussion started by: satish51392111
2 Replies

5. Shell Programming and Scripting

Korn/bash Script to monitor a file a check for specific data

Hi, Im trying to write this script but im stuck on it, basicaly what i want to do is to write a code to verify a log file ( apache log file for example ) and for each new line with specific data , then, output this new line for another file: full ex: output of the server.log is (... (4 Replies)
Discussion started by: Thales.Claro
4 Replies

6. Solaris

Directory restriction for specific users on Solaris

Hi all, i have a question about directory accessing. Question: therese is a x user which can login system, x user can only access specific directories on the system, even y directory has r-x access right for OTHER, x user will not access the y directory. this x user must access specific... (4 Replies)
Discussion started by: nibiru78
4 Replies

7. Shell Programming and Scripting

script to monitor directory

What is the best way for a script to run to monitor a directory for the presence of files and then perform a function afterwords? I was hoping to have it continually run and sleep until it detects that files are present in the directory, then break out of the loop and go on to the next step. ... (17 Replies)
Discussion started by: nulinux
17 Replies

8. UNIX for Dummies Questions & Answers

Hep with script to monitor directory

Hello, I am a newbie who is attempting to write a script to monitor a directory for a set of 3 files that I am expecting to get ftp'd. Occasionally, we suspend operations for maintenance etc. but we still get the files so there can be more than 1 set. If there is more than 1 set, I would like... (2 Replies)
Discussion started by: cmf00186
2 Replies

9. Programming

Monitor which users enter my home directory

Hi, I would like to monitor which users enter my home directory. Is it possible to write a script or code to do this. I donot have admin privileges. I have given read permissions to access my home directory. Any pointers in this direction is helpful! Thanks, Pradeep Ps: I use the... (1 Reply)
Discussion started by: mnpradeep
1 Replies
Login or Register to Ask a Question