LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-16-2005, 12:30 PM   #1
grobarusrcu
LQ Newbie
 
Registered: Nov 2005
Posts: 2

Rep: Reputation: 0
diskwatch.sh


can someone please help me i need this for my school.

How can i calculate how many users have home directories over a specific size and flag those users in the report, or list all files in /tmp that are over 60 days old

here's the script the base script

#!/bin/bash

# diskwatch.sh
# script to create/mail disk reports

echo -e "From: Disk Usage Monitor <devnull@localhost>
Subject: Disk usage on / on `date`
To: <root@localhost>

FILESYSTEM USAGE:
`/bin/df`

USAGE IN /home:
`/bin/du -h -s /home/*`

USAGE IN /tmp:
`/bin/du -h -s /tmp`
" | /usr/sbin/mail root

i dont know how to upgrade it to calculate how many users have home directories over a specific size and flag those users in the report, or list all files in /tmp that are over 60 days old

Thanks in advance
 
Old 11-16-2005, 12:40 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hi,

and homework questions aren't permitted. Have a look
at finds man-page .... for the count of home-directories also
look at the tool wc

man find
/size

man find
/ctime



Cheers,
Tink
 
Old 11-16-2005, 12:45 PM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
If you don't use the -h option on "du", it will be much easier to compare the home-dir size to a specific size.

Read this info-page to learn about finding files of a specific "age":
Code:
bash$ info find "finding files" time
 
  


Reply



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
diskwatch.sh grobarusrcu Linux - Newbie 1 11-16-2005 12:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:21 PM.

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
Open Source Consulting | Domain Registration