LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-28-2011, 03:52 AM   #1
casualzone
Member
 
Registered: Jan 2010
Posts: 189

Rep: Reputation: 15
how to write a cron jobs in linux to monitor my project diskspace usage?


how to write a cron jobs in linux to monitor my project diskspace usage?
check diskspce= du -h .

any clue for me as a beginner?
 
Old 07-28-2011, 04:08 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You could use something like
Code:
/bin/df -h |  /bin/mail -s "diskusage" you@you.com
Kind regards
 
Old 07-28-2011, 04:11 AM   #3
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 542

Rep: Reputation: 79
Well what do you want your cron to do exactly?

Send an email? Write a log file? Etc...
if so, write a script which does what you want, and them put this script in your crontab

to add a cron just type
Code:
crontab -e
Angel.
 
Old 07-28-2011, 11:28 PM   #4
casualzone
Member
 
Registered: Jan 2010
Posts: 189

Original Poster
Rep: Reputation: 15
the diskspace is shared between peers.
I use du -h . to check my disk usage.

to be more specific, I want to have a cron job which will send me my project directory disk usage and send me a mail everyday in order for me to monitor it.
I need this because my simulation results will be stopped if hitting my disk quota / limit.


crontab -e
du -ah /diskpath/ | mail -s "diskusage" you@mail.com

crontab: installing new crontab
"/tmp/crontab.XXXX1osPQ8":1: bad minute
errors in crontab file, can't install.
 
Old 07-29-2011, 05:41 AM   #5
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
errors in crontab file, can't install.
You need to specify the time you want to run the crontab
See
http://adminschoice.com/crontab-quick-reference

Kind regards
 
Old 08-01-2011, 09:39 PM   #6
casualzone
Member
 
Registered: Jan 2010
Posts: 189

Original Poster
Rep: Reputation: 15
could i use this without admin command?
 
Old 08-01-2011, 11:09 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If you've got quotas enabled, you could use http://linux.die.net/man/1/quota
 
Old 08-02-2011, 04:22 AM   #8
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
Originally Posted by casualzone View Post
could i use this without admin command?
Yes, create the cron as a user.

Kind regards
 
  


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
cron hourly, daily, cron.d jobs don't execute eggsmartha Linux - General 3 09-17-2007 06:37 PM
wierd diskspace usage kniwor Linux - Newbie 2 08-29-2006 06:36 AM
Cron Jobs christo512 Linux - Software 1 02-09-2006 09:19 AM
Linux Cron Jobs dibyendra Programming 0 08-19-2003 09:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:33 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