LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Check the system (https://www.linuxquestions.org/questions/linux-newbie-8/check-the-system-748929/)

elainelaw 08-20-2009 12:51 AM

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

EricTRA 08-20-2009 01:04 AM

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

Uncle_Theodore 08-20-2009 01:57 AM

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.

JulianTosh 08-20-2009 03:09 AM

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'..


All times are GMT -5. The time now is 04:40 PM.