[Buildroot] Trouble with cron / crontab
Fabrice Mousset | GEOCEPT GmbH
fabrice.mousset at geocept.com
Fri Mar 20 13:02:10 UTC 2015
> Von: Thomas Petazzoni [mailto:thomas.petazzoni at free-electrons.com]
> On Fri, 20 Mar 2015 11:20:36 +0000, Fabrice Mousset | GEOCEPT GmbH
> > I am facing a strange issue with Buildroot 2015.02. I am using cron/crontab
> from Busybox but can't start/define any cronjob because
> /var/spool/cron/crontabs didn't exist on my rootfs.
> > On my rootfs there is no /var/spool/cron but this exist on output/target.
> > I haven't found anything in documentation about cron...
> > Is there something I have missed?
> In the skeleton:
> $ ls -l system/skeleton/var/
> total 4
> lrwxrwxrwx 1 thomas thomas 6 mars 8 2014 cache -> ../tmp
> drwxr-xr-x 2 thomas thomas 4096 mars 5 15:40 lib
> lrwxrwxrwx 1 thomas thomas 6 mars 8 2014 lock -> ../tmp
> lrwxrwxrwx 1 thomas thomas 6 mars 8 2014 log -> ../tmp
> lrwxrwxrwx 1 thomas thomas 7 mars 17 15:28 run -> ../run/
> lrwxrwxrwx 1 thomas thomas 6 mars 8 2014 spool -> ../tmp
> lrwxrwxrwx 1 thomas thomas 6 mars 8 2014 tmp -> ../tmp
> So /var/spool is a symbolic link to /tmp, which means it resides on tmpfs. You
> could change the cron init script to create /var/spool/cron at boot time, but I
> guess it wouldn't be very useful as you would lose your cronjob definitions at
> each reboot I believe.
> So maybe we need to change the default Busybox configuration to store the
> crontab somewhere or re-think /var/spool as being in tmpfs.
> Best regards,
Thank you for your help, indeed I found that /tmp/spool is an symlink. So I started to write an initscript (/etc/init.d/S99crontab) to create symlink from /etc/crontab.d to /var/spool/crontab
So my cron jobs definitions will be stored in /etc/crontab.d/, I don't know if it is a good idea, but it is easy to setup ;-)
More information about the buildroot