• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Stop Cron Job emailing me notifications

I have set up a Cron Job in cPanel and it emails me a notification every day when Cron Job is completed. I want the Cron Job to continue but dont need a daily email from it - once a week would be fine...
0
TheCommander
Asked:
TheCommander
  • 2
1 Solution
 
woolmilkporcCommented:
To avaid these emails add

>>/path/to/logfile 2>&1

at the end of the crontab entry.

Set up a new weekly cronjob to send the output file to you via email and to clear it afterwards.

0 0 * * * 0 /usr/bin/mailx -s "Cron LOG" TheCommander@enterprise.com < /path/to/logfile && rm -f /path/to/logfile

wmp
0
 
fourckCommented:
in Cpanel, in the cronJobs setup page there is a text box where you can specify the destination email  that you wish the cron job to send when executed.
all what you have to do is to leave this textbox empty, and save your settings.

N.B: in case it is empty and you still receive emails,  recheck your script, maybe there is a function called within your script to send email when executed.

Good luck !
0
 
TheCommanderAuthor Commented:
Dont need this anymore - resloved in house.
0
 
TheCommanderAuthor Commented:
my tech guy figured and fixed.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now