Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 11th September 2006, 14:48
st2xo st2xo is offline
Member
 
Join Date: Jan 2006
Location: Wiesloch [DE]
Posts: 47
Thanks: 3
Thanked 0 Times in 0 Posts
Default strange mail log cutting at 16:45 daily, incomplete mail logs

Hi - I have problems with a strange mail log behaviour:
  • the /var/log/mail.ispconfigsave contains the daily logs from 16:45 to 23:59 only.
    example: log entrys between Sep 9 23:59 and Sep 10 16:45 are missing
  • the daily logfiles /var/log/mail.info-YYYYMMDD.gz are containing
    the entries from 16:45 to 16:45
    example: mail.info-20060909.gz
    first entry: Sep 8 16:45:15
    last entry: Sep 9 16:45:02
  • Logrotation is as default:
    1. /etc/cron.daily/logrotate runs /etc/logrotate.conf
    2. /etc/logrotate.conf is default, contains nothing related to 16:45
      (only the default values: weekly, rotate 4, create)
    3. /etc/logrotate.d contains no postfix file
  • the ispconfig jobs in crontab are croned as default (23:59, 0:30, 0:40 etc.), there is no cronjob around 16:45 (nevertheless the ispconfig log-jobs are reading the logfiles only, not cutting them, right?)

I would like to have the logfiles cutted at 0:00
After looking for related threads here and asking google I´m quite confused now .....

Can anybody help or give me a hint, a url ..... thanks in advance!
__________________
regards,
Stefan.
Reply With Quote
Sponsored Links
  #2  
Old 12th September 2006, 12:48
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,744
Thanks: 840
Thanked 5,598 Times in 4,409 Posts
Default

ISPConfig is reading and copying the logfiles nightly, not at 16:45.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 12th September 2006, 17:02
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

Quote:
Originally Posted by st2xo
contains nothing related to 16:45
Did you check /etc/crontab?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #4  
Old 20th September 2006, 13:57
st2xo st2xo is offline
Member
 
Join Date: Jan 2006
Location: Wiesloch [DE]
Posts: 47
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Hi till&falko,

sorry form my late reaction, was ill, no possibilty to check my mails

Quote:
Originally Posted by till
ISPConfig is reading and copying the logfiles nightly, not at 16:45.
Yes, the ispconfig cron jobs are all right and they´re default from the installation

Code:
59 23 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/ftp_logs.php &> /dev/null
59 23 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/mail_logs.php &> /dev/null
59 23 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/cleanup.php &> /dev/null
0,30 * * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/check_services.php &> /dev/null
15 3,15 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/quota_msg.php &> /dev/null
30 00 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/logs.php &> /dev/null
40 00 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/traffic.php &> /dev/null
30 03 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/backup.php &> /dev/null
00 04 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/webalizer.php &> /dev/null



Quote:
Originally Posted by falko
Did you check /etc/crontab?
contains:

Code:
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin
MAILTO=root
#
# check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly
#
-*/15 * * * *   root  test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons >/dev/null 2>&1
what I have to check?
__________________
regards,
Stefan.
Reply With Quote
  #5  
Old 21st September 2006, 15:28
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

Quote:
Originally Posted by st2xo
contains:

Code:
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin
MAILTO=root
#
# check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly
#
-*/15 * * * *   root  test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons >/dev/null 2>&1
what I have to check?
This cron job runs every 15 minutes, so it also runs at 16.45h. What's the output of
Code:
ls -la /usr/lib/cron/run-crons
? If it's a file, what's in it?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #6  
Old 21st September 2006, 15:43
st2xo st2xo is offline
Member
 
Join Date: Jan 2006
Location: Wiesloch [DE]
Posts: 47
Thanks: 3
Thanked 0 Times in 0 Posts
 
Default

Quote:
Originally Posted by falko
This cron job runs every 15 minutes, so it also runs at 16.45h
Yes, but why not 15:30 oder 7:15 or something else?


Code:
ls -la /usr/lib/cron/run-crons
-rwxr--r--  1 root root 6054 Sep  9  2005 /usr/lib/cron/run-crons
and

Code:
more /usr/lib/cron/run-crons
#!/bin/bash
#
# /usr/lib/cron/run-crons
#
# Copyright (c) 1998-2001 SuSE GmbH Nuernberg, Germany. All rights reserved.
#
# this script looks into /etc/cron.{hourly,daily,weekly,monthly} for
# scripts to be executed.  The info about last run is stored in
# /var/spool/cron/lastrun
#
# concept similar to debian and redhat
#
# Changes:
#     1998 - Burchard Steinbild <bs@suse.de>, 1998
#         initial version
#     before 2001 - va@org.chemie.uni-frankfurt.de
#        send an email with name of date-script instead of cron entry
#         "Subject: cronjob@www - daily - FAILURE"
#        (better one script for each date-sub-script)
#        requires changes to /etc/crontab
#        append > /dev/null 2>&1  to the line calling run-cons
#     2001-09-11
#        updated to Suse 7.2 merged
#     2001-09-12
#        changed FAILURE detection, until now all scripts with output
#        had "failed", now only scripts with error status != 0
#        have failed.
#     2001-09-13 - ro@suse.de
#        merged with 7.3: call logger with exit value for scripts
#        respect MAILTO as cron does
#        use mktemp -d for all tmpfiles
#        add variable to disable mail if all jobs returned 0
#

# set to "true" to send a mail even if all scripts returned OK
SEND_MAIL_ON_NO_ERROR=false

BASENAME=`/usr/bin/basename $0`
LOGGER="/bin/logger -t $BASENAME[$$]"

export LC_TIME=POSIX
TMPDIR=`mktemp -d /tmp/run-crons.XXXXXX`
trap "rm -rf $TMPDIR" 0 1 2 3 13 15

# Priority change for sub scripts.
# range: highest -20 ... 19 lowest prioriy
#  default processes start in level 10
CRON_SCRIPT_NICE_VALUE=15
SPOOL=/var/spool/cron/lastrun

# CRON Result EMail is sent to
if test -z "$MAILTO" ; then
  SEND_TO="root"
else
  SEND_TO="$MAILTO"
fi

#
# Don't run jobs on laptops, that are AC-offline
#
if test -x /usr/bin/on_ac_power ; then
        on_ac_power -q
        if [ "$?" = "1" ]; then
                exit 0
        fi
fi

mkdir -p $SPOOL

#set verbose
## stage 1,  search directories/scripts to run
RUN=""
for CRONDIR in /etc/cron.{hourly,daily,weekly,monthly} ; do
    test -d $CRONDIR || continue
    BASE=${CRONDIR##*/}
    TIME_EXT=${BASE##cron.}

    test -e $SPOOL/$BASE && {
        case $BASE in
          cron.hourly)  TIME="-cmin  +60 -or -cmin  60" ;;
          cron.daily)   TIME="-cmin +1440 -or -cmin 1440"  ;;
          cron.weekly)  TIME="-cmin +10080 -or -cmin 10080"  ;;
          cron.monthly) NOW=`date +%s`
                        LASTMONTH=`date -d "last month" +%s`
                        DIFF=`expr '(' $NOW - $LASTMONTH ')' / 86400`
                        TIME="-ctime +$DIFF"
                        ;;
        esac
        # remove all lock files for scripts that are due to run
        eval find $SPOOL/$BASE $TIME | \
             xargs --no-run-if-empty rm
    }
    if test ! -e $SPOOL/$BASE ; then
        # accept this dir, if it isn't empty
        LIST=`find $CRONDIR ! -type d`
        if [ ! -z "$LIST" ] ; then
            RUN="${RUN} ${TIME_EXT}"
        fi
    fi
done


##  STATUS communication variable between
#     function run_scripts ()
#   and loop-over-all-scripts
#   set in run_scripts to FAILURE if this script failed!
#   else it is empty
#   because it is never reset to empty after the initialization
#   it implements an OR like logic over all scripts
##
STATUS=""

# helper, run all scripts in one cron directory
function run_scripts (){
    local CRONDIR=$1
    local TIME_EXT=$2


    local TEMP_MSG=$TMPDIR/run-crons.${TIME_EXT}.$$
    rm -r $TMPDIR/run-crons.${TIME_EXT}.* >/dev/null 2>&1

    # keep going when something fails
    set +e
    for SCRIPT in $CRONDIR/* ; do
        test -d $SCRIPT && continue
        case "$SCRIPT" in
               .svn)           continue ;;
               *.rpm*)         continue ;;
               *.swap)         continue ;;
               *.bak)          continue ;;
               *.orig)         continue ;;
               \#*)            continue ;;
               *~)             continue ;;
        esac
        /sbin/checkproc $SCRIPT && continue
        if test -x $SCRIPT ; then
            BASESCRIPT=`/usr/bin/basename $SCRIPT`

            nice -n ${CRON_SCRIPT_NICE_VALUE} $SCRIPT >$TEMP_MSG 2>&1

            local ERRNO=$?
            if [ 0 -eq $ERRNO ] ; then
                # dummy action
                echo "SCRIPT: $BASESCRIPT, OK."
            else
                echo "$BASESCRIPT returned $ERRNO" | $LOGGER -p warn
                echo "SCRIPT: $BASESCRIPT exited with RETURNCODE = $ERRNO."
                STATUS="FAILURE"
            fi
            # write some wrapper text around the original output
            if [ -s "$TEMP_MSG" ] ; then
                echo "SCRIPT: output (stdout && stderr) follows"
                echo ""
                cat $TEMP_MSG
                echo -e "SCRIPT: $BASESCRIPT\n------- END OF OUTPUT"
                echo ""
                echo ""
            fi

            rm -f $TEMP_MSG > /dev/null 2>&1
        else
            echo "WARNING: $SCRIPT is not executable, script is ignored !"
        fi
    done
}

# stage 2:
#   run all scripts  and collect output into one mail
#   for each TIME_EXT with a meaningfull subject.
#
if [ ! -z "${RUN}"  ] ; then
    for EXT in ${RUN} ; do
        CRONDIR="/etc/cron."${EXT}
        test -d $CRONDIR || continue
        BASE=`/usr/bin/basename $CRONDIR`
        TIME_EXT=${BASE##cron.}
        STATUS=""

        if test ! -e $SPOOL/$BASE ; then
            CONTROL_MAIL=$TMPDIR/run-crons.$$

            echo "running ${TIME_EXT} cronjob scripts" >> ${CONTROL_MAIL}
            echo "" >> ${CONTROL_MAIL}

            touch $SPOOL/$BASE

            run_scripts  ${CRONDIR} ${TIME_EXT} >> ${CONTROL_MAIL} 2>&1
            TITLE="cronjob@$HOSTNAME - ${TIME_EXT}"
            if [ -n "${STATUS}" ] ; then
                TITLE="${TITLE} - ${STATUS}"
            else
                TITLE="${TITLE} - OK"
            fi
            if [ -n "${STATUS}" -o "$SEND_MAIL_ON_NO_ERROR" = true ] ; then
                mail ${SEND_TO} -s "${TITLE}" < ${CONTROL_MAIL}
            fi

            rm -f ${CONTROL_MAIL}
        fi
    done
fi

#
# now make sure, we have no lastrun files dated to future
#
touch $SPOOL
NOW=`date -u +%s`
for i in `find $SPOOL -type f`
do
    FILEDATE=`date -u -r $i +%s`
    # allow for up to one hour in the future because of summer/wintertime
    if [ `expr $FILEDATE - $NOW` -gt 3600 ]
    then
        rm $i
    fi
done
/usr/lib/cron/run-crons is default from system- and ispconfig-installation, no changes on that file were made.

and so on:

Code:
ls -la /var/spool/cron/lastrun
-rw-r--r--  1 root root    0 Sep 20 16:45 cron.daily
__________________
regards,
Stefan.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Not receiving any incoming mail. Jcorrea920 General 11 3rd April 2010 14:08
Core 4: Error Messages on Fresh Install re CTX/SSL jjw Installation/Configuration 30 6th September 2006 13:16
Can not recieve mail with de virtual mail adress Mounir Installation/Configuration 9 25th July 2006 00:16
Virtual Users And Domains With Postfix, Courier And MySQL (+ SMTP-AUTH, Quota, SpamAs mholownych HOWTO-Related Questions 10 29th May 2006 04:39
Virtual Users And Domains With Postfix, Courier And MySQL (+ SMTP-AUTH, Quota, SpamAs ebbay Installation/Configuration 9 4th March 2006 12:47


All times are GMT +2. The time now is 11:33.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.