[SOLVED] - Every cron entry twice

Issues related to applications and software problems
User avatar
warron.french
Posts: 579
Joined: 2014/03/27 20:21:58

[SOLVED] - Every cron entry twice

Post by warron.french » 2021/04/08 13:42:30

Hello, in my /var/log/cron file for the past 4 weeks, which is the limit for as far back as I can go due to logrotate I have every single line duplicated in the log file twice.

I execute several scripts out of /var/spool/cron/root and I want to keep it that way.

As I mentioned every single thing that is executed via crond regardless of /etc/cron.d, /etc/cron.daily, /etc/cron.hourly, /etc/cron.weekly - whatever, it is all listed for every entry twice.

Any ideas?
Last edited by warron.french on 2021/04/13 14:49:18, edited 1 time in total.
Thanks,
War

User avatar
TrevorH
Forum Moderator
Posts: 30657
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Every cron entry twice

Post by TrevorH » 2021/04/08 14:20:18

How many lines of output do you get from

ps fax | grep [c]rond
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Whoever
Posts: 1206
Joined: 2013/09/06 03:12:10

Re: Every cron entry twice

Post by Whoever » 2021/04/09 03:02:48

warron.french wrote:
2021/04/08 13:42:30
Hello, in my /var/log/cron file for the past 4 weeks, which is the limit for as far back as I can go due to logrotate I have every single line duplicated in the log file twice.

I execute several scripts out of /var/spool/cron/root and I want to keep it that way.

As I mentioned every single thing that is executed via crond regardless of /etc/cron.d, /etc/cron.daily, /etc/cron.hourly, /etc/cron.weekly - whatever, it is all listed for every entry twice.

Any ideas?
Are the cron entries running twice, or just being logged twice?

I would not be too hard to write a simple script to append the date to a file, which cron runs every 10 minutes. Then you can see by the timestamps written to the file whether it actually ran twice or not.

User avatar
warron.french
Posts: 579
Joined: 2014/03/27 20:21:58

Re: Every cron entry twice

Post by warron.french » 2021/04/12 11:57:17

TrevorH wrote:
2021/04/08 14:20:18
How many lines of output do you get from

ps fax | grep [c]rond
I see a total of two, one of them for /us/sbin/crond -n, and the other for egrep.
Thanks,
War

User avatar
warron.french
Posts: 579
Joined: 2014/03/27 20:21:58

Re: Every cron entry twice

Post by warron.french » 2021/04/12 12:01:57

Whoever wrote:
2021/04/09 03:02:48
warron.french wrote:
2021/04/08 13:42:30
Hello, in my /var/log/cron file for the past 4 weeks, which is the limit for as far back as I can go due to logrotate I have every single line duplicated in the log file twice.

I execute several scripts out of /var/spool/cron/root and I want to keep it that way.

As I mentioned every single thing that is executed via crond regardless of /etc/cron.d, /etc/cron.daily, /etc/cron.hourly, /etc/cron.weekly - whatever, it is all listed for every entry twice.

Any ideas?
Are the cron entries running twice, or just being logged twice?

I would not be too hard to write a simple script to append the date to a file, which cron runs every 10 minutes. Then you can see by the timestamps written to the file whether it actually ran twice or not.
The cron entries do not appear to be running twice as I checked on of my cron'd scripts and saw that it is only being executed once every minute; which my script does something precisely like what you are describing as a test anyway.

I just see entries like this, but for every entry regardless of source:

Code: Select all

Apr 12 07:51:01 servername CROND[28389]: (root) CMD (/usr/lib64/sa/sa1  1  1)
Apr 12 07:51:01 servername CROND[28389]: (root) CMD (/usr/lib64/sa/sa1  1  1)
Thanks,
War

User avatar
TrevorH
Forum Moderator
Posts: 30657
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Every cron entry twice

Post by TrevorH » 2021/04/12 12:11:16

I see a total of two, one of them for /us/sbin/crond -n, and the other for egrep.
Then you didn't cut and paste my command properly. The reason for "grep [c]rond" is to stop the grep from appearing in the output.
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
warron.french
Posts: 579
Joined: 2014/03/27 20:21:58

Re: Every cron entry twice

Post by warron.french » 2021/04/12 12:42:54

@Trevor, sorry, you are correct. I used egrep instead of grep.

Just one line of output now, simply the /usr/sbin/crond -n.
Thanks,
War

Whoever
Posts: 1206
Joined: 2013/09/06 03:12:10

Re: Every cron entry twice

Post by Whoever » 2021/04/12 15:12:12

What's in your /etc/rsyslog.conf?

User avatar
warron.french
Posts: 579
Joined: 2014/03/27 20:21:58

Re: Every cron entry twice

Post by warron.french » 2021/04/12 15:58:18

@Whoever, are you referring to the rules that forward data to /var/log/cron or are you referring to the lines at the top that define the IM rules?
Thanks,
War

Whoever
Posts: 1206
Joined: 2013/09/06 03:12:10

Re: Every cron entry twice

Post by Whoever » 2021/04/13 02:19:03

I suggest you post everything that isn't a comment.

Post Reply

Return to “CentOS 7 - Software Support”