LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-20-2009, 12:51 AM   #1
elainelaw
Member
 
Registered: Jan 2008
Posts: 258

Rep: Reputation: 30
Check the system


I would like to write a script to check do the system ,

if the directory size larger than xxx KB or no.of files is more that xxx , then send alert mail to me , can adivse what can i do ?

can advise what can i do ? thx
 
Old 08-20-2009, 01:04 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello,

Find out which commands give you the result you want, try them out, put them all together in a logical order in a shell script and voila. Homework done!

Post what you have so far and/or what errors you are encountering and I'm sure someone will take it up.

Kind regards,

Eric
 
Old 08-20-2009, 01:57 AM   #3
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 69
I didn't quite get your description of the condition you want to check, but the find command has all the options you need to check the sizes of files and directories and process the information. du is another useful command in this regard.
 
Old 08-20-2009, 03:09 AM   #4
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
du is the command you want to start off with

'du -ah .' will list all the files and their sizes in the current directory. The list line will be the total size of the current directory. For the number of files, you can count all the other lines with 'wc -l'. Use 'head' and 'tail' to isolate parts of the beginning and end of the output from 'du'..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
An error Occurred during the file system check. Dropping you to shell; the system wil aneikei Linux - Newbie 3 02-11-2010 07:38 PM
file system check 383gene Linux - Newbie 5 01-29-2009 05:08 PM
how can I check my system? Perquisitor Linux - Security 12 12-10-2007 12:04 PM
How to check system specifications? Niceman2005 Linux - Newbie 5 04-25-2005 04:21 AM
What to Check to make sure system is OK asmith1972 Linux - Newbie 7 05-20-2004 07:13 AM


All times are GMT -5. The time now is 08:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration