The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Custom cron email headers

Discussion in 'E-mail Discussions' started by linkhostmedia, Feb 16, 2010.

  1. linkhostmedia

    linkhostmedia Member

    Joined:
    Feb 3, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Hi Folks,

    I have a cron set up in cPanel which sends an email with the results as expected. I'm wondering if there's a way in cPanel to customize the headers of the cron emails. Right now I seem to have no control over them. Eg:


    From: Cron Daemon <root@location.myserver.net>
    Subject: Cron <user@location> php -q /home/user/public_html/fn/fn.sitemap-autoupdate.php


    Ideas for updating these? Cron job works fine - no issue with that.

    Thanks.
     
    #1 linkhostmedia, Feb 16, 2010
    Last edited: Feb 17, 2010
  2. linkhostmedia

    linkhostmedia Member

    Joined:
    Feb 3, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    After a long wait... bump...

    Anyone have input on this?

    Thanks,
    Jason
     
  3. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,453
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    I'm curious as to what you'd like to customize in the header?
     
  4. linkhostmedia

    linkhostmedia Member

    Joined:
    Feb 3, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I'd like to change the subject line of the cron email so it's more helpful for my client. Right now, this is my cmd:

    Code:
    curl --silent http://www.example.com/volunteersystem/v_reminder.php
    Which produces this subject in the email:

    I tried this:

    Code:
    curl --silent http://www.example.com/volunteersystem/v_reminder.php 2>&1 | mail -s "Custom Subject" me@example.com
    The above works fine, except if there's no output it still sends a blank email with something like "blank output; I hope that's okay". A normal cron just won't send the email if there's no output from php.

    For some reason php mail() won't work if I'm using php -q so that's why I'm using curl.

    Thoughts?
     
  5. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,453
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You are able to edit/add the subject and have, but you'd like it to not send a cron email at all if there's no output?

    Sounds like this would be on that script the cron runs to check for changes or updates and then: if/else, if theres changes send, if not, don't. Not sure you can do anything there with a cronjob.
     
Loading...

Share This Page