Results 1 to 7 of 7

Thread: Add Crontab jobs to images

  1. #1

    Add Crontab jobs to images

    Hi.

    Some programs should be executed every five minutes. Its easy to set up a cronjob table by hand after loging on the router, but if I try to make them part of the image they do not work. The crontab file is part of the image since I can see on the router; but calling: crontab -e exits with:
    " crontab: unable to create /var/spool/cron/crontab.316 "

    my crontabfile:
    * * * * * /bin/foo # foo is called each minute

    Makefile:
    install:
    mkdir -p $(INSTALLDIR)/var/spool/cron/crontabs
    install -D crontab $(INSTALLDIR)/var/spool/cron/crontabs/admin

    Is there an other way to store 'static' crontabs? I think I could set them up via post-boot procedure but I though it would be prettier to do it this way.

    kind regards
    DerFuchs

  2. #2
    Why not just add /var/spool/cron/crontabs/admin to /usr/local/.files?
    Store it in flashfs..

    S.

  3. #3
    Quote Originally Posted by barsju
    Why not just add /var/spool/cron/crontabs/admin to /usr/local/.files?
    Store it in flashfs..
    Does it mean that /var/spool/cron/crontabs/admin would survive a firmware upgrade?

    The firmware has to be deployed on nine routers. Thats why I prefer one ready-to-go firmware which can be upload via webinterface. Telnet and friends are also disabled for security reasons.

    kind regards
    DerFuchs

  4. #4
    Join Date
    Dec 2003
    Location
    Russian Federation
    Posts
    8,356
    Type flashfs save and you will see a flashfs image. Then read /sbin/flashfs script to understand the things.

  5. #5
    Quote Originally Posted by DerFuchs
    Is there an other way to store 'static' crontabs? I think I could set them up via post-boot procedure but I though it would be prettier to do it this way.
    Do a recursive grep through the source for files containing the term "post-boot." I don't know exactly when it's called, but that'll tell you. You could put your crond command there, after post-boot is called.

  6. #6
    Does it mean that /var/spool/cron/crontabs/admin would survive a firmware upgrade?
    Yes it will survive, but not be enabled. For that you need to type "flashfs enable".

    So as I see it you can use Tomilius's way and have a one-step installation, but you will need to recompile each new FW.
    Or you can use my way, avoiding the recompile but having a two-step installation.

    You should be able to use curl to make a script for upgrading all nine at once using the hidden admin page to call flashfs enable.

    S.

  7. #7
    Quote Originally Posted by tomilius
    Do a recursive grep through the source for files containing the term "post-boot." I don't know exactly when it's called, but that'll tell you. You could put your crond command there, after post-boot is called.
    Thank you. I found the post-boot call in rc/rc.c added eval("/bin/cronfoo.sh") which calls the setup cronjob script and rebuild the image. Everything is working now the expected way.

Similar Threads

  1. Problem with simple cron jobs
    By oldudu in forum WL-500g Q&A
    Replies: 27
    Last Post: 10-07-2006, 13:35
  2. WL-330g inside images
    By pekr in forum WL-300g Pics & Specs
    Replies: 1
    Last Post: 14-11-2005, 14:38
  3. More space with small images
    By silver in forum WL-500g Custom Development
    Replies: 0
    Last Post: 01-03-2005, 03:39
  4. WL-300g images
    By silver in forum WL-300g Pics & Specs
    Replies: 2
    Last Post: 21-02-2005, 09:35
  5. Setting up crontab and other boot questions
    By nOBeLium in forum WL-500g Q&A
    Replies: 3
    Last Post: 03-02-2005, 22:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •