I installed Logwatch with this command: yum install logwatch

Always send me logs at 3:00 server hour (I not configured this hour), how can I change cron’s hour?.

Because at this moment my server is doing backups and I want to get logs after finalize.

Problem/question: where can I change the logwatch’s cron?.

Thank you!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi there @computereleon,

The logwatch default cronjob is specified at /etc/cron.daily/0logwatch.

You could create another cronjob for a specific time with the following command:

crontab -e

Then add the following line:

0 0  * * *          /usr/sbin/logwatch --output mail

Change the time depending on when you would like to run the job. The above would run every day at midnight.

In case that you need to, you can use this crontab editor to get the correct time:

https://crontab.guru/

Hope that this helps.
Regards,
Bobby

  • Thank you very much friend.

    Last question please: if I add cronjob with “crontab” command, I will receive logwatch’s email 2 times every day. I need remove the default logwatch’s cron.

    I edited the file /etc/cron.daily/0logwatch but not have cron, check her content:

    #!/bin/sh
    
    #Set logwatch location
    LOGWATCH_SCRIPT="/usr/sbin/logwatch"
    #Add options to this line. Most options should be defined in /etc/logwatch/conf/logwatch.conf,
    #but some are only for the nightly cronrun such as --output mail and should be set here.
    #Other options to consider might be "--format html" or "--encode base64", man logwatch for more details.
    OPTIONS="--output mail"
    
    #Call logwatch
    $LOGWATCH_SCRIPT $OPTIONS
    
    exit 0
    

    How can I disable default logwatch’s cron for not receive two times every day?.

    Thank you very much again!

    • Hi there @computereleon,

      Yes indeed, what you could do is just remove the logwatch file from the cron.daily folder or edit the file and comment out this line:

      # $LOGWATCH_SCRIPT $OPTIONS
      

      Hope that this helps!
      Regards,
      Bobby

      • Oh perfect, you are the best.

        Last question please:

        If I comment # $LOGWATCH_SCRIPT $OPTIONS and create new cron with /usr/sbin/logwatch –output mail, this new cron will be execute with my custom configuration in file “/usr/share/logwatch/default.conf/logwatch.conf”?.

        My question is because you told me comment/disable “$LOGWATCH_SCRIPT $OPTIONS” and create a new cron without “$OPTIONS”.

        Thank you again.

Submit an Answer