Crontab doesn't work

I have written a sh script(name:ZSTU.sh,path:/root/ZSTU.sh).
when I type:

chmod u+x /root/ZSTU.sh
sh /root/ZSTU.sh

It worked.
But I want it to run at 7:00 everyday,and here is the contents of /etc/crontabs/root:

0 0 7 * * * /root/ZSTU.sh

However,it doen't work at 7:00 every morning.
When I type:

logread -e cron 

It just back:

Thu Jun 20 18:02:32 2024 cron.err crond[29275]: crond (busybox 1.35.0) started, log level 5
Thu Jun 20 18:04:23 2024 cron.err crond[30434]: crond (busybox 1.35.0) started, log level 5
Thu Jun 20 18:06:54 2024 cron.err crond[31954]: crond (busybox 1.35.0) started, log level 5
Thu Jun 20 18:18:59 2024 cron.err crond[6432]: crond (busybox 1.35.0) started, log level 5
Thu Jun 20 18:41:22 2024 cron.err crond[19254]: crond (busybox 1.35.0) started, log level 5

This log just has the massage that it has started.That's main my script is not working as schedule.
HOW TO SOLVE IT?

Add a logger entry to your script, see if it actually fires.

Fix your keyboard 1st.

it looks like you are using busybox which is fine but I think it takes 5 and not 6 parameters:

https://openwrt.org/docs/guide-user/base-system/cron

So try with removing the first 0

5 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.