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
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?
/etc/anacrontab but I'm not sure if it's used by the system. There's no
journalctl -u cronie reports
No journal files were found., but I have the fillowing in
May 18 00:01:01 pi CROND: (root) CMD (run-parts /etc/cron.hourly) May 18 00:01:01 pi anacron: Anacron started on 2013-05-18 May 18 00:01:01 pi anacron: Will run job `cron.daily' in 6 min. May 18 00:01:01 pi anacron: Will run job `ron.weekly' in 26 min. May 18 00:01:01 pi anacron: Jobs will be executed sequentially May 18 00:07:01 pi anacron: Job `cron.daily' started May 18 00:08:00 pi anacron: Job `cron.daily' terminated May 18 00:27:01 pi anacron: Job `ron.weekly' started May 18 00:27:01 pi anacron: Job `ron.weekly' terminated May 18 00:27:01 pi anacron: Normal exit (2 jobs run) May 18 01:01:01 pi CROND: (root) CMD (run-parts /etc/cron.hourly) May 18 02:01:01 pi CROND: (root) CMD (run-parts /etc/cron.hourly) May 18 03:01:01 pi CROND: (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: 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
anacron to ignore timestamps in order to force execution of jobs.
/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.