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.

WHM Backup Cron Job Output Log file Needs to be Email

Discussion in 'E-mail Discussions' started by miles100, Apr 1, 2012.

  1. miles100

    miles100 Member

    Joined:
    Apr 1, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi There,

    I'll be very happy if someone can give me a clear/simple solution for my issue.
    I configured daily backups from whm interface.
    And I setup a cron job in crontab to run the backup job at 1.30am.
    I also configured email as given below. Backups run at 1.30AM as setup and I receive the email as I setup as below. My Problem is the emil body is blank. In the words, I want the backup log file to be emailed after the backup is done. Can someone help me to put a line or something to get the backup outlook log file emailed instead of the blank email? Following is my current config ?

    30 1 * * * /usr/local/cpanel/scripts/cpbackup | mail -s "Daily Backup Completed" myemail@domain.com
    40 4 * 7 * /scripts/upcp

    I also tried the following method and still no luck in getting the output log file emailed.
    MAILTO=myemail@domain.com
    30 1 * * * /usr/local/cpanel/scripts/cpbackup

    My OS is Centos
    Thanks
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,481
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    The cPanel system is already setup to email root and send a backup log by default. By your post it sounds like you're going around that and setting this up manually or am I mistaken?
     
  3. miles100

    miles100 Member

    Joined:
    Apr 1, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thanks for the reply. Like you said the cpanel system should already send the log. In my case I did not get any emails.
    I'm using an external email address. I do receive the email because I have the above configuration. Issue is email is blank and no output log file. Any suggestions to get it working from centos linux os or even from whm? Cheers
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,481
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    It might be easier to track down the reason why you're not getting system emails than to reinvent the wheel to do the task. I don't have any suggestions on building your own script, but if the server is not sending out system alert emails, including backup completed with attached logs, you might check your mail queue and see if you see them sitting in there.

    Depending on the Tier of cPanel you're on, you might even be able to locate those emails by searching for them:
    WHM > Email > Mail Delivery Reports

    These areas should be checked to make sure you're using a valid email address:
    WHM > Server Configuration > Basic cPanel & WHM Setup, Contact Info tab.
    WHM > Server Contacts > Change System Mail Preferences.


    And here is the area where you chose what you want to be to be contacted about:
    WHM > Server Contacts > Contact Manager.
    Setting a priority of Low (or better) on all will send you emails on all items listed there.

    Personally I have all of these set to Low, if that helps.

    Mail must be working on the server, and you need to of course use a valid email address for this all to work. :)
     
  5. miles100

    miles100 Member

    Joined:
    Apr 1, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi, Thanks again. Funny thing was I was in the middle of WHM > Server Contacts > Contact Manager just before I checked your post. My priorities were set to disable. I changed all of them to low including cpanel backups. I also included 2 email addresses in WHM > Server Configuration > Basic cPanel & WHM Setup, Contact Info tab just now.
    It should work now I guess. I will not force the backup process now. I will let it run at the scheduled time and update you once successful. I will also remove the re-invented wheel(my cron tab email pipe command):). Cheers
     
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,481
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You're welcome. Happy to help.
     
  7. miles100

    miles100 Member

    Joined:
    Apr 1, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Problem solved. the backup log was emailed successfully. Now I get the complete log. However I found this error for some of the files in the log "Cannot stat: Permission denied". I assume this is an ownership issue of certain files and folders within each cpanel user. Many thanks for your help.
     
  8. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,481
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Sounds like you're on the right path there with your assumption. :)
     
Loading...

Share This Page