0

Dears,

i configured script in crontab to run every 10 minutes and its not working at all. I dont see any entry in configured log path (/var/log/cron)

"*/10 * * * * example_script.sh"

However if i change crontab syntax to following:

"* * * * * example_script.sh"

It executing script every 10 minutes. I see that in configured log path Crond is running, it even has been restarted. No errors in cron log file. example_script.sh is just an example, i have it configured with absolute path. Also it works accordingly with the same crontab configuration but on the other system which serves for the same purpose (just in another network zone)

Why is that happening? Are there any config files allowing to modify crontab syntax itself?

Sudoo
  • 11
  • 3
  • 1
    Do you actually have the quotes in your crontab? And the typo `examlpe`? – Gerald Schneider Nov 18 '22 at 10:21
  • No, those quotes are only for formating purpose for this site. i have it configured without quotes – Sudoo Nov 18 '22 at 10:29
  • 2
    When you ask `cron` to execute every 10 minutes , it does not execute. Yet when you ask `cron` to execute every minute , it somehow executes every 10 minutes ! I think you are not interpreting the Execution output correctly. **Append a line with timestamp** to `/tmp/mycronlogger` in your Script & I am sure you will see that it is working Correctly on time. Still , when that is not working , you can then include the timestamp lines to the Post which will help Debug further. – Prem Nov 18 '22 at 14:45
  • please try to reference your `example_script.sh` with absolute path and make sure that script is executable. Also make sure crond daemon is running on your system. – Roman Spiak Nov 19 '22 at 09:12
  • @RomanSpiak - example_script.sh is just as an example, i have it configured with ablosule path. Crond is running on my system, it has even been restarted. It all works accordingly on other linux server which serves for the same purpose just in different network zone. – Sudoo Nov 20 '22 at 10:44
  • @Prem logging is already configured in rsyslogd to log script execution to /var/log/cron and i literally see that it is being executed every 10 minutes – Sudoo Nov 20 '22 at 10:45

3 Answers3

1

not all versions of cron support the step extension.

check the crontab(5) man page to see what your version supports.

man 5 crontab

if you can't use */10 you'll have to do it the long way - with a list

0,10,20,30,40,50 * * * * example_script.sh
Jasen
  • 826
  • 6
  • 12
  • As said in the post, i have 1:1 server which have it configured */10 and it works. It however might have some configured files changed over the time of usage and i rather think it can be some OS related issue – Sudoo Nov 20 '22 at 16:08
1

Root password expired so i changed it to never expire and i must have wait a while to have cron working accordingly

Sudoo
  • 11
  • 3
0

It is strange that the following is executing it every 10 minutes:

* * * * * example_script.sh

It should run it every minute. Or do you have some sleep in your example_script.sh?

How do you configure the cronjob? Just crontab -e or are you placing it somewhere in /etc/cron.d?

C-nan
  • 131
  • 2
  • Yep, i know thats strange thats why im looking for an answer outside of the documentation. I dont have any sleep configured in script, i did configured it with crontab -e. As already said, same config works on other server – Sudoo Nov 20 '22 at 16:10
  • If it is running every 10 minute, I think somewhere you have `*/10` even though you don't see it. Have you rebooted the machine? Just to be sure that all services are restarted. – C-nan Nov 21 '22 at 07:17