Scheduler UI creates incorrect crontab entries for time intervals >= 15 mins

Issue #304 invalid
Mike Bell created an issue

FW: Version 2023.4 on Asus RT-AC68U B2

Steps to reproduce:

  1. Under Administration / Scheduler create a command under Custom 1
  2. Set the Days to Everyday
  3. Set the Time to Every 15 mins
  4. Using ssh, view the file /var/spool/cron/crontabs/root. The schedule for “#sch_c1” is set to “15 18 14 12 *” (or similar)

Remarks:

  • Values < 15 minutes produce the correct crontab entry
  • The same problem occurs if the value of 15 minutes is entered using the Every … custom value option.
  • All values 15 minutes or greater have the same issue., producing slightly different wrong entries in the crontab file.

Comments (5)

  1. pedro repo owner

    I’m sorry, but I think that you don’t know how cron works in FreshTomato (entries are added dynamically) - but at least you should check it first ;) :

    //EDIT: sorry, to be exact: entries added by scheduler

    .

    And see log:

    .

    At 20:28:36 I added above entry in scheduler (ok, a few seconds later, “test TIMESTAMP 30 minutes” was run in the shell just before I c;licked save in scheduler).

  2. Mike Bell reporter

    Thanks for looking at this. I’m not seeing the same behavior as you.

    Can you (or anyone else) point me at any documentation of how cron works in tomato?

    If I set scheduled command 1 to every 30 minutes every day the command is never run, (started running later than expected) and the root crontab becomes:

    root@PHB68:/var/spool/cron/crontabs# cat root
    0 */1 * * * logger -p syslog.info -- -- MARK -- #syslogdmark#
    */15 * * * * rcheck --cron #rcheck#
    44 4 * * * /usr/sbin/adblock update #adblockJob#
    26 17 4 1 * sched sch_c1 #sch_c1#
    

    But if I set it to every 5 minutes it becomes:

    root@PHB68:/var/spool/cron/crontabs# cat root
    0 */1 * * * logger -p syslog.info -- -- MARK -- #syslogdmark#
    */15 * * * * rcheck --cron #rcheck#
    44 4 * * * /usr/sbin/adblock update #adblockJob#
    */5 * * * 0,1,2,3,4,5,6 sched sch_c1 #sch_c1#
    

    Which is the expected behavior. (And the command runs every five minutes as expected).

    The data posted by the browser to set the option is:

    _ajax=1&_nextpage=admin-sched.asp&_service=sched-restart&sch_rboot=0,0,127&sch_rcon=0,0,127&sch_c1=1,-30,127&sch_c2=0,-30,127&sch_c3=0,-30,127&sch_c4=0,-30,127&sch_c5=0,-30,127&rboot_enabled=on&rcon_enabled=on&c1_enabled=on&c1_time=-30&c1_every=5&c1_sun=on&c1_mon=on&c1_tue=on&c1_wed=on&c1_thu=on&c1_fri=on&c1_sat=on&c1_everyday=on&sch_c1_cmd=/mnt/PHB/Reports/email_reports.py&c2_enabled=on&c3_enabled=on&c4_enabled=on&c5_enabled=on&_http_id=TID693d9c99ddcd8554
    

    Which suggests that it is not a browser-specific (Firefox) issue.

    Note that the processor is ARMv7 Processor rev 0 (v7l) (32-bit). Does it perhaps work correctly on a 64-bit processor?

    The same behavior occurs with version  2023.5 K26ARM USB AIO-64K on an Asus RT-AC68U B2

    [I would have investigated this further but I got stuck finding my way around the tomato src files: if you can suggest where I can find the logic is that interprets the post call and updates the crontab entry I will take another look.]

  3. Log in to comment