Shibby build5x-110-EN / Scheduler does not launch a shell script

Discussion in 'Tomato Firmware' started by darksky, Jul 16, 2013.

  1. darksky

    darksky Addicted to LI Member

    Running Shibby's TomatoUSB on an RT-U66N. For the purposes of testing, I have removed the "cron" package from optware and have rebooted the router.

    I want to run a script (/opt/bin/logger) once every 15 min, so I went to:

    Administration>Scheduler>Custom 2 and pasted in the following:
    Enabled = [X]
    Time = [Every 15 minutes]
    Days = (all are checked including 'everyday')

    I then saved the screen committing the changes but the script never runs. I can manually run it from ssh and it runs just fine so I am at a loss as to why I can't automate executing it.

    Inspecting my logs in the web GUI, I see that indeed cron (internal cron I am assuming since I removed dixie cron from optware) is running:

    Code: crond[614]: crond: crond (busybox 1.20.2) started, log level 8
    Jul 16 12:15:01 easier crond[614]: crond: USER root pid 1679 cmd rcheck --cron
    So we see that at 12:15 something happened, but the script did not run.

    EDIT: I figured it out! The problem is that I pointed the scheduler to /opt/bin/logger instead of /tmp/mnt/router/optware/bin/logger

    I have /opt as a bind mount to /tmp/mnt/router/optware so apparently this is a bug in the code? Shibby? Logged as issue #510 for you.
  2. leandroong

    leandroong LI Guru Member

    To see if your scheduler is running, you would see it get added when you type, "cru l". My created scheduled works in current version 110.
  3. darksky

    darksky Addicted to LI Member

    Thanks for the tip; /usr/sbin/cru is news to me!
  4. jerrm

    jerrm Network Guru Member

    That doesn't sound right. I've never had that issue. My home router alone (on Shibby 110) has about six or so /opt/bin scripts scheduled, all on bind mounted folders. Currently have units on several recent Shibby versions, all with /opt/bin scripts running as scheduled.
  5. darksky

    darksky Addicted to LI Member

    Dunno what to tell you... it is reproducible.
  6. jerrm

    jerrm Network Guru Member

    It looks like you are using the admin-sched.asp page to create the jobs?

    Past below into web gui Tools->System page and post results for working and non-working entries.
    echo cru  =======================================
    cru l
    echo ls   =======================================
    ls -l /opt/bin/
    echo nvram sched  ===============================
    nvram show | grep sch_
  7. koitsu

    koitsu Network Guru Member

    I'm in agreement with jerrm; something doesn't sound right there. I've been following this thread and going over reasons/possibilities for a couple days now and none of them make any sense (so many I can't even begin to list them all off here). I do have one theory, but I'm holding off on stating anything about that until I can see some output.

    I would appreciate seeing output from this as well (please pay close attention to the flags):

    /bin/df -k
    /bin/ls -ld / /opt /opt/bin
    /bin/ls -ld /tmp /tmp/mnt /tmp/mnt/router /tmp/mnt/router/optware
  8. darksky

    darksky Addicted to LI Member

    # df -k
    Filesystem          1K-blocks      Used Available Use% Mounted on
    /dev/root                6848      6848        0 100% /
    tmpfs                  127944      148    127796  0% /tmp
    devfs                  127944        0    127944  0% /dev
    /dev/sda1              1941460    146672  1696164  8% /tmp/mnt/router
    /dev/sda1              1941460    146672  1696164  8% /opt
    # ls -ld / /opt /opt/bin
    drwxr-xr-x  19 root    root          220 Jun  9 13:28 /
    drwxr-xr-x  12 root    root          4096 Jul 17 16:56 /opt
    drwxr-xr-x    2 root    root          4096 Jul 17 17:04 /opt/bin
    # /bin/ls -ld /tmp /tmp/mnt /tmp/mnt/router /tmp/mnt/router/optware
    drwxrwxrwx    8 root    root          180 Dec 31  1969 /tmp
    drwxr-xr-x    3 root    root            60 Dec 31  1969 /tmp/mnt
    drwxr-xr-x    6 root    root          4096 Jul 17 17:48 /tmp/mnt/router
    drwxr-xr-x  12 root    root          4096 Jul 17 16:56 /tmp/mnt/router/optware
  9. koitsu

    koitsu Network Guru Member

    And output from /bin/mount please?
  10. darksky

    darksky Addicted to LI Member

    Just so you know, I flashed the firmware from Shibby's to Toastman's about 5 min ago... I don't know if this is a valid test anymore as a result... the three commands from my prev post are identical under toastman's so I won't bother retyping them.

    # mount
    rootfs on / type rootfs (rw)
    /dev/root on / type squashfs (ro)
    proc on /proc type proc (rw)
    tmpfs on /tmp type tmpfs (rw)
    devfs on /dev type tmpfs (rw,noatime)
    sysfs on /sys type sysfs (rw)
    devpts on /dev/pts type devpts (rw)
    usbfs on /proc/bus/usb type usbfs (rw)
    /dev/sda1 on /tmp/mnt/router type ext3 (rw,nodev,noatime,data=ordered)
    /dev/sda1 on /opt type ext3 (rw,nodev,noatime,data=ordered)
  11. koitsu

    koitsu Network Guru Member

    Thanks. All the output you've provided looks perfectly correct.

    herefore, from my analysis, there is absolutely no explanation for this. As indicated by the above output, there is absolutely no difference between /tmp/mnt/router and /opt at the filesystem level, or at the file permissions level. Even chroot'ing cannot explain the claim.

    Any kind of delineation that's being done -- if there even is -- is being done within the TomatoUSB part of the code, else is somehow user error.

    If you can provide me clear, concise, itemised, step-by-step instructions as to how to go about repeating it, I can look into trying to reproduce the issue and look at the underlying code, but be aware that I am not willing to change firmwares (I run tomato-K26USB-1.28.0502.8MIPSR2Toastman-RT-N-Ext.trx).
  12. darksky

    darksky Addicted to LI Member

    I can't reproduce this under toastman's build[1]. In other words, croning the bind mount works as expected.

    1. tomato-K26USB-NVRAM64K-1.28.0502.8MIPSR2Toastman-RT-N-VLAN-Ext.trx
  13. koitsu

    koitsu Network Guru Member

    Important: you are not using a symlink. You are using a bind mount, or otherwise known as a "loopback mount", which works at a very different level (within the VFS layer of the kernel itself) rather than at the filesystem level. A symlink is very different and susceptible to different complexities; bind mounts are generally superior in this regard.
  14. darksky

    darksky Addicted to LI Member

    I used the incorrect term. Is is not a symlink, it is indeed a bind mount. Edited.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice