LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 02-05-2009, 11:09 AM   #1
Barefootpanda
LQ Newbie
 
Registered: Oct 2008
Posts: 10

Rep: Reputation: 0
VERY simple crontab question about mailing results


I don't know what it is, but I cannot think of a smooth way to do this...

I want to email the results of just one line of the crontab to an all@domain.com, but can't figure it out.

I want a 'du --max-depth=1' on a folder to run every Mon, Wed, Sat night at midnight and email the results.

I keep finding things for MAILTO=XXX, but won't that email EVERY cron event?


I'm sure this is simple and I just don't know how to ask google the right way. Thanks for any tips fellas.
 
Old 02-05-2009, 11:14 AM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
What about giving explicit commands in the script itself?
Code:
/usr/sbin/sendmail "all@domain.com" << EOF
From: Me <me@domain.com>
To: Me <me@domain.com>
Subject: checking disk space
$(du --max-depth=1 /path/to/dir)
EOF
 
Old 02-05-2009, 11:15 AM   #3
Barefootpanda
LQ Newbie
 
Registered: Oct 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Great idea! I was obsessed with doing it in the cron, but this makes far more sense.

You are thinking that I would then run this script from the cron?
 
Old 02-05-2009, 11:19 AM   #4
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Quote:
Originally Posted by Barefootpanda View Post
You are thinking that I would then run this script from the cron?
Of course! I have some cron jobs which notify me when the job is done using this method. Just check the path of sendmail on your machine and modify it accordingly.
 
Old 03-03-2009, 11:45 AM   #5
Barefootpanda
LQ Newbie
 
Registered: Oct 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Sorry to revive a dead system, but I want to do this same thing, but this time I'm trying to use msmtp...it's a FreeNAS box and the community there is pretty quiet.

So I've tried just tweaking the script but it's not working at all. I am planning on just using the generic smtp.comcast.net so I don't have to deal with authentication. I also really want to avoid using the system config file because FreeNAS uses it for all kinds of stuff.

I'm VERY unfamiliar with msmtp and don't even know if it's possible to give it a straight command w/o using a config file first. Thoughts?
 
  


Reply

Tags
cron, crontab, mailto


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on DD and mailing results booyaadewd Linux - General 1 09-20-2006 02:17 PM
[crontab] emailing non-empty results G00fy Programming 5 09-20-2006 02:16 AM
Simple question about command syntax ping/log ping results ohalnet Linux - Networking 1 07-25-2006 05:46 AM
Issue with cron mailing results OneBinary Debian 4 01-02-2006 11:30 PM
defining an external smtp server for mailing results of chkroot cron job xfurious_mindx Linux - General 0 03-15-2004 10:23 AM


All times are GMT -5. The time now is 02:03 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration