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 - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-20-2009, 04:00 PM   #1
alpha01
Member
 
Registered: Jul 2008
Location: Orange County
Distribution: Ubuntu/Debian, CentOS, RHEL, FreeBSD, OS X
Posts: 75

Rep: Reputation: 19
Cron emails


I've researching online and I haven't found anything relevant about changing the default subject line that crond sends out for errors.

Does anyone know if its even possible to customize cron subject lines on emails?

Orignal: Crom<user@server>/home/user/nameofscript.sh

Customize line: nameofscript has failed?
 
Old 02-20-2009, 04:24 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
As far as I know, the way cron determines the subject is hardcoded in the cron source code. Anyway, you can force the cron job to send a custom e-mail instead of the default one, redirecting the standard error to the standard output and piping the result of the job to the mail command using a custom subject. For example:
Code:
0 6 * * * /home/user/nameofscript.sh 2>&1 | mail -s "nameofscript.sh has failed" user
 
  


Reply

Tags
crond, server



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 job emails chrisk5527 Linux - General 1 03-08-2004 05:56 PM
cron emails Mikessu Linux - Newbie 1 01-02-2004 08:11 PM
Prevent Cron from sending emails carmeng Linux - Software 3 11-10-2003 05:08 AM
cron Emails Gattancha Linux - General 1 07-25-2003 04:05 PM
Cron has stopped sending emails shanagg Linux - General 0 07-02-2003 01:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:29 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
Open Source Consulting | Domain Registration