Cron job with wrong schedule

General support questions
Post Reply
joaoalvesjr
Posts: 3
Joined: 2023/06/30 17:28:25

Cron job with wrong schedule

Post by joaoalvesjr » 2023/06/30 17:50:11

cron setup

56 09 23 6 5 /u01/scripts/imp_UseallCA_E2.sh

Cron Log

Jun 30 09:56:01 svsgp23 CROND[3167812]: (oracle) CMD (/u01/scripts/imp_UseallCA_E2.sh)
Jun 30 09:56:03 svsgp23 CROND[3167810]: (oracle) CMDOUT (Import: Release 19.0.0.0.0 - Production on Fri Jun 30 09:56:03 2023)
Jun 30 09:56:03 svsgp23 CROND[3167810]: (oracle) CMDOUT (Version 19.17.0.0.0)
Jun 30 09:56:03 svsgp23 CROND[3167810]: (oracle) CMDOUT ()
Jun 30 09:56:03 svsgp23 CROND[3167810]: (oracle) CMDOUT (Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.)

You can verify that the JOB has been executed.
The date was ignored and the day of the week prevailed.
Why? How do I resolve this?

User avatar
TrevorH
Site Admin
Posts: 33269
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Cron job with wrong schedule

Post by TrevorH » 2023/06/30 18:05:36

56 09 23 6 5
You've specified all the possible fields and some conflict with others. So you've told that to run at 59 minutes past 09 hours on the 23rd of the 6th month *and* on the 5th day of the week (Friday). It is telling you that it decided to run it on Friday and ignore the bit about the 23rd. If it only ran on Friday the 23rd then it would be about another 7 years until it next ran (when the 23rd June is next on a Friday).

See man 5 crontab for all the details of how to specify an entry.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

joaoalvesjr
Posts: 3
Joined: 2023/06/30 17:28:25

Re: Cron job with wrong schedule

Post by joaoalvesjr » 2023/06/30 18:17:42

I want to represent a schedule that runs only on 6/23 at 9:56 am.
When I did that, it ran on 6/23 and 6/30.

User avatar
TrevorH
Site Admin
Posts: 33269
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Cron job with wrong schedule

Post by TrevorH » 2023/06/30 18:28:10

You also told it to run on Friday so it did.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

joaoalvesjr
Posts: 3
Joined: 2023/06/30 17:28:25

Re: Cron job with wrong schedule

Post by joaoalvesjr » 2023/06/30 18:56:54

The problem is there. It ignored the date parameter and considered the day of the week.
As you yourself identified the next execution should be in 7 years. If you consider all the parameters.

lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: Cron job with wrong schedule

Post by lightman47 » 2023/06/30 19:38:52

?

I am now a little confused. The Day of Month is ignored if a Day of Week is entered?

User avatar
TrevorH
Site Admin
Posts: 33269
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Cron job with wrong schedule

Post by TrevorH » 2023/07/01 02:03:55

Read the fine Man page
Note: The day of a command's execution can be specified in the following two fields — 'day of month', and 'day of
week'. If both fields are restricted (i.e., do not contain the "*" character), the command will be run when either
field matches the current time. For example,
"30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: Cron job with wrong schedule

Post by lightman47 » 2023/07/01 15:26:48

Strange way to do it, but thank you.

Post Reply