Score:0

changed crontab, jobs run at old AND new time now

bm flag

I did a non-best practice on /etc/crontab and manually changed it to run a daily cron job at a specific time, initially for testing so I could make sure it fired off correctly.

/etc/crontab looked like this:

42 18 * * * root /etc/cron.daily/cronjob1
-*/15 * * * * root {built-in out-of-the-box crontab entry}

Once I was satisfied the job ran as expected, I removed that entry from /etc/crontab, restarted crond, and added a new crontab as root using "crontab -e"

00 00 * * * /bin/sh /etc/cron.customjobs/cronjob1

"new" /etc/crontab:

-*/15 * * * * root {built-in out-of-the-box crontab entry}

Since this change, the job runs at 1842 AND at midnight every day. The system has even been rebooted at least twice since then and still the job runs at the old time. I'm not sure why the 1842 start time is stuck in the system somewhere and I am going crazy trying to track this down. SLES15 if that helps

I've tried looking in /var/spool/cron/tabs and only the one I manually created using crontab -e is listed there. I'm not sure what else is supposed to be holding the timer that isn't in the crontab(s) anymore.

Romeo Ninov avatar
in flag
Why you have dash (`-`) in from on `*/15`?
Jim W avatar
bm flag
That's the way the crontab installed itself, I didn't do that
Score:0
in flag

Normally there is default cron entry (possibly found in /etc/cron.d/ or provided by anacron when not in /etc/crontab) that runs all scripts/executables found in the /etc/cron.daily directory.

That would typically be the job specification that will execute:

/etc/cron.daily/cronjob1
          ˆˆˆˆˆ

Your root crontab runs a different script:

/etc/cron.customjobs/cronjob1
          ˆˆˆˆˆˆˆˆˆˆ

That would be a reason why cronjob1 runs twice

tsc_chazz avatar
vn flag
Also - don't forget that there are separate crontabs per user.
Jim W avatar
bm flag
I thought I mentioned it, but the cron.daily job was moved to cron.customjobs, so the script only appears once yet runs twice
Jim W avatar
bm flag
Also, when I double checked, there *was* an entry in /etc/cron.d for the job which I completely overlooked before
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.