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

Two init Scripts?

Discussion in 'Tomato Firmware' started by MiseryQ, Aug 2, 2007.

  1. MiseryQ

    MiseryQ Network Guru Member

    I'd like to run two init scripts but haven't found any info on doing it.

    One script is:
    Code:
    sleep 3
    touch /etc/adblock.conf
    sleep 2
    logger adblock.conf created
    logger Remainder of init script starting
    For adblocking. The other is:
    Code:
    #!/bin/sh
    I=`nvram get wl0_ifname`
    while sleep 1; do
    if [ "`wl assoclist`" != "" ]; then
    XFER=`ifconfig $I|grep bytes`
    if [ "$XFER" != "$PXFER" ]; then
    LED="amber on white on"
    PXFER=$XFER
    else
    LED="amber on white off"
    fi
    else
    LED="amber off white off"
    fi
    if [ "$LED" != "$PLED" ]; then
    led $LED
    PLED=$LED
    fi
    done
    To turn have the LED show wireless status.

    Thanks.
     
  2. yaqui

    yaqui LI Guru Member

    just take the first line out of that last script and it should be fine....
    So, just put all this in init:
    Code:
    sleep 3
    touch /etc/adblock.conf
    sleep 2
    logger adblock.conf created
    logger Remainder of init script starting
    I=`nvram get wl0_ifname`
    while sleep 1; do
    
      if [ "`wl assoclist`" != "" ]; then
         XFER=`ifconfig $I|grep bytes`
    
         if [ "$XFER" != "$PXFER" ]; then
            LED="amber on white on"
            PXFER=$XFER
            else
            LED="amber on white off"
         fi
    
      else
      LED="amber off white off"
      fi
    
    if [ "$LED" != "$PLED" ]; then
       led $LED
       PLED=$LED
    fi
    
    done
     
  3. bogderpirat

    bogderpirat Network Guru Member

    what about sshing to your router, echo""ing the contents of the adblock.conf into a file in a writable directory, chmod a+x'ing the file and then just put a "/directory/adblock.conf &" in the end of the init script?
     
  4. MiseryQ

    MiseryQ Network Guru Member

    bogderpirat, That gets a big "HUH?" from me. :)

    Just got home from work and the LED is working as it had before.
    Even still I changed the script as recommended by yaqui

    Thanks guys.
     
  5. yaqui

    yaqui LI Guru Member

    I think bodgerpirat doesn't realize that contents of adblock.conf is not a script! lol
     
  6. bogderpirat

    bogderpirat Network Guru Member

    worth a shot :(
     

Share This Page