It seems to work well using the crontab command from within your init
script - assuming your cron is associated with a service. 

in start():
  (crontab -l 2>/dev/null | grep -v $0
            echo "*/10 * * * * $0 checksomething"
        ) | crontab - 2>/dev/null

in stop():
  crontab -l 2>/dev/null | grep -v $0 | crontab -

and then check for the "checksomething" argument to your init script. It
is self contained, and installed/removed on start/stop. 


On Wed, 2008-07-16 at 21:11 +0200, Jens Nachtigall wrote:
> Am Mittwoch, 16. Juli 2008 20:47 schrieb Benoît Ganne:
> > > How is it possible to create a crontab entry while creating a package?
> >
> > [...]
> >
> > > But I would like to do it at such time that the crontab is already
> > > modified on the firmware image?
> >
> > I'm not sure to understand: you just want to add a crontab entry at
> > package installation time, right ?
> > If so, you can use the target Package/packagename/postinst to add such
> > entry with a little shell script.
> > You can see an example here:
> > https://dev.openwrt.org/cgi-bin/trac.fcgi/browser/packages/admin/muninlite/
> >Makefile This package add entries to /etc/inetd.conf and /etc/services at
> > installation time.
> > In fact, what's directly under such target (until the keyword 'endef' is
> > encountered) will be copied verbatim as a post-install script in your
> > package at build time.
> 
> Interesting, but a bit of a dirty hack for something like cronjobs imho. I  
> always wondered if there is something like /etc/cron.d/   and   /etc/{hourly|
> daily|monthly} for openwrt? But obviously there is not.
> 
> jens
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to