Arch ARM comes with cronie
cron daemon. However I can't find the system crontab file and running crontab -l
as root returns no crontab for root
.
systemctl is-enabled cronie
reports enabled
I have a number of script in the /etc/cron.period
directories but suspect they might not get executed. For example I have a script in cron.weekly
that hasn't run for 9 days. It can be executed manually and has these file flags:
-rwxr--r-- 1 root root 1,7K 24 apr 23.55 task1.cron*
How can I check that there's a schedule for the /etc/cron.period
directories and where do I find the system crontab?
There's /etc/anacrontab
but I'm not sure if it's used by the system. There's no /etc/crontab
.
update: journalctl -u cronie
reports No journal files were found.
, but I have the fillowing in /var/log/everything.log
:
May 18 00:01:01 pi CROND[30893]: (root) CMD (run-parts /etc/cron.hourly)
May 18 00:01:01 pi anacron[30898]: Anacron started on 2013-05-18
May 18 00:01:01 pi anacron[30898]: Will run job `cron.daily' in 6 min.
May 18 00:01:01 pi anacron[30898]: Will run job `ron.weekly' in 26 min.
May 18 00:01:01 pi anacron[30898]: Jobs will be executed sequentially
May 18 00:07:01 pi anacron[30898]: Job `cron.daily' started
May 18 00:08:00 pi anacron[30898]: Job `cron.daily' terminated
May 18 00:27:01 pi anacron[30898]: Job `ron.weekly' started
May 18 00:27:01 pi anacron[30898]: Job `ron.weekly' terminated
May 18 00:27:01 pi anacron[30898]: Normal exit (2 jobs run)
May 18 01:01:01 pi CROND[32633]: (root) CMD (run-parts /etc/cron.hourly)
May 18 02:01:01 pi CROND[32645]: (root) CMD (run-parts /etc/cron.hourly)
May 18 03:01:01 pi CROND[32653]: (root) CMD (run-parts /etc/cron.hourly)
anacron
appears to be active but the weekly job seems to be missing the character c at the beginning of its name. I wonder if could have anything to do with weekly scripts not running.
update 2: I restored (an unedited) /etc/anacrontab
:
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
I then ran anacron -T
to test /etc/anacrontab
validity, following the anacron man page. It reported no errors.
I then tried anacron -n -d
and got this:
Anacron started on 2013-05-18
Checking against 25 with 30
Normal exit (0 jobs run)
That seems odd. I had expected to run the three jobs (cron.daily, cron.weekly, cron.monthly). -n
is supposed to run jobs immediately but that seems not to happen.
update 3: I noticed that run-parts --test
doesn't list scripts that have extensions. I also needed to add -f
to anacron
to ignore timestamps in order to force execution of jobs.
update final: /etc/anacrontab
is indeed the system crontab as @Lekensteyn indicated. The reason some of my scripts were not running was because those script names contained dots (e.g. task1.cron) which is not accepted by run-parts
, as documented in its man page:
If neither the --lsbsysinit option nor the --regex option is given then the names must consist entirely of ASCII upper- and lower-case letters, ASCII digits, ASCII underscores, and ASCII minus-hyphens.
I can now consistently force jobs to run by executing anacron -dfn cron.weekly
or some other job name, or all jobs if the job name is omitted.