1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Why won't this script work?

Discussion in 'Tomato Firmware' started by yaqui, Sep 1, 2007.

  1. yaqui

    yaqui LI Guru Member

    Code:
    ## Wireless Conn Notice
    wlnote='/tmp/wlnote.sh'
    (
    cat <<'ENDFILE'
    #!/bin/sh
    xfer=0
    pxfer=0
    if wl assoclist | grep -v <mac here> ; then
    xfer=$(ifconfig eth1|grep bytes|cut -d":" -f2|cut -d" " -f1)
    sleep 30
    pxfer=$(ifconfig eth1|grep bytes|cut -d":" -f2|cut -d" " -f1)
    fi
    if [ "$xfer" -ge 1 ] && [ "$pxfer" -gt 1 ] && [ "$xfer" -ne "$pxfer" ] ; then
    led amber on
    if [ `grep -c Amber /var/log/messages` -lt 15 ] ; then
    logger 'Wireless activity detected Amber light ON'
    fi
    else
    led amber off
    fi
    ## Limit Log message ##
    if [ `grep -c Wlnotify /var/log/messages` -lt 15 ] ; then
    logger 'Wlnotify script executed'
    fi
    ENDFILE
    ) > $wlnote
    if [ -f "$wlnote" ] ; then
    chmod 777 $wlnote
    logger $wlnote created
    else
    logger Problem creating $wlnote
    fi
    cru a wnotify "*/1 * * * * $wlnote"
    Edit: Corrected script after I found out how to get it working.... this should now work. Variable expansion has to be turned off !
     
  2. yaqui

    yaqui LI Guru Member

    bump... please help?
     
  3. yaqui

    yaqui LI Guru Member

    bump
     
  4. azeari

    azeari LI Guru Member

    maybe noone knows. lol.. try asking on a different forum?
     
  5. roadkill

    roadkill Super Moderator Staff Member Member

    try adding what is it suppose to do eventually maybe there is another way to accomplish it....
     
  6. yaqui

    yaqui LI Guru Member

    Its supposed to turn Amber led on when there is wireless activity other than my wireless network printer.

    Plus limit log messages. It does not do either of these things.
     
  7. yaqui

    yaqui LI Guru Member

  8. yaqui

    yaqui LI Guru Member

    I finally got this bastard working !! See last post on devshed forum for the reason why it was not working.
     
  9. danix71

    danix71 LI Guru Member

    I'd like a script for Tomato to mail me on a gmail when a broken connection is up again.
    So: when a PPPoE connection is restablished, mail to me. :biggrin:
     
  10. mraneri

    mraneri LI Guru Member

    I really wish there was some sendmail equivalent in tomato...
    Maybe that will make it into 1.11.

    I haven't figured out any way to send any e-mail via Tomato.

    - Mike
     
  11. danix71

    danix71 LI Guru Member

    Maybe can be done with a script, that's why I've asked. I know that's not an option in Tomato...:(
     
  12. roadkill

    roadkill Super Moderator Staff Member Member

    try masqmail
     
  13. danix71

    danix71 LI Guru Member

    :) Linux is not my strongest point, that's why I beseeched for a script. :)
     
  14. roadkill

    roadkill Super Moderator Staff Member Member

    it's not that complex...
     
  15. danix71

    danix71 LI Guru Member

    Oke, wiki-it and google-it. :)
     
  16. mraneri

    mraneri LI Guru Member

    I'd ldeally perfer a solution which can send mail from a stock Tomato firmware... I.e. No special compiles, or installs...

    I would have no idea where to start with masqmail.
     
  17. roadkill

    roadkill Super Moderator Staff Member Member

    I doubt that you will find smtp functionality in a script...
     
  18. mstombs

    mstombs Network Guru Member

    I'm not sure it fits with the fast/slim philosophy to have sendmail built in BUT because Tomato is so slim everyone can have some size of jffs partition (not sure about loading apps from cifs). We could have a library of standalone binaries that for scripts - I wouldn't have though mail would need specific kernel support?
    NB any utility needs to built with the correct toolchain against the same kernel...
     
  19. roadkill

    roadkill Super Moderator Staff Member Member

    mini-sendmail is even smaller (5-10K) and it got an IPK which can used to wget it from the web and unpack it to /tmp directory so in a way you could get that functionality in a script...
     

Share This Page