Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cronjob cron.daily does not run (debian)

Tags:

cron

debian

I got a script to run daily at any time. So /etc/cron.daily seems to be an easy solution.

But now I got the problem, the cronjob won't run that script. It seems like the cronjob won't run any of the daily jobs.

So I tried to put it to cron.hourly and everything worked fine. But I dont want to run the backup script every hour.

/etc/init.d/cron start|stop works without errors.

/etc/crontab looks like default:

 m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report     /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

As it won't run I tried to install anacron but without any changes.

Why does it run the hourly scripts but not the daily ones?

Many thanks to all of you!

like image 275
user2032654 Avatar asked Dec 04 '22 00:12

user2032654


1 Answers

It might be, that one of your daily-scripts is misbehaving. Try running them manually. I removed the logwatch package and the cron.daily job and it worked again.

This is my /etc/crontab

# /etc/crontab: system-wide crontab

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
16 * * * * root cd / && run-parts --report /etc/cron.hourly
12 2 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
41 1 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
9 3 30 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

try running the daily like so

 run-parts -v --report /etc/cron.daily

you can also use --list or --test for more output. In my case I removed the misbehaving script and the daily job worked again

like image 120
Leo Tulipan Avatar answered Dec 11 '22 15:12

Leo Tulipan