Tomato - "Init" script in web-interface didn't do what i want

Discussion in 'Tomato Firmware' started by Lunchpack, May 16, 2018.

  1. Lunchpack

    Lunchpack New Member Member

    Hello together,

    i have a problem and need your help.

    i have a netgear wnr3500L with "Tomato Firmware 1.28.0000 MIPSR2-140 K26 USB miniVPN".
    Backround: The Router makes a wireless lan only for my amazon-dash-buttons which shall start a LED blinking on my raspberry pi.

    At first: if I start the script manually with telnet/ssh at the router it works great, but if i start it as an init-script its not working (complete).

    echo "LABEL=optware /opt ext3 defaults 1 1" >> /etc/fstab
    sleep 5
    /opt/bin/bash /opt/script/ &
    so after mount opt i want to start the script with the name
    This script test permanently if someone push the dash-button and if yes it send a command with ssh to the raspberry pi to let blink the LED:
    while sleep 3
    if "button pushed" >/dev/null
    /opt/bin/bash /opt/script/
    echo -n "001 - " >> /opt/script/button.log
    date +"%d-%m-%Y %H-%M-%S" >> /opt/script/button.log && sleep 10
    echo "button is not in use" >/dev/null
    done makes the connection to the raspberry:

    ssh -i /root/.ssh/id_rsa root@ "bash /opt/script/"

    okay now the problem:
    as i said, if i start the script manually everything works great: i push the button, the raspberry starts blinking and the date with the "button-number" is written in the log.

    but if i start the script by init in the webif (administartion --> scripts) it checks if the button was pushed, it writes down in the log-file the date and the button-number but the led's didn't start blinking. but i have no idea why.

    do you have?

    Thanks so much :)
  2. eibgrad

    eibgrad Network Guru Member

    Just a guess, but it may be that when logged into a shell, your path is pointing to /opt/bin/bash, so it works. But when init is started, it doesn't have that path (/opt/bin), so the line "bash /opt/script/" in doesn't work.

    IOW, specify the full path to bash in the script.
    Monk E. Boy and Lunchpack like this.
  3. Lunchpack

    Lunchpack New Member Member

    "bash /opt/script/" is correct because its the command which is started at the raspberry, and the raspberry don't know /opt/bin/bash

    but i found the solution with your idea after days and days of searching for the solution. needs:
    /opt/bin/ssh -i /root/.ssh/id_rsa root@ "bash /opt/script/"

    now its perfect. thank you :)
    Monk E. Boy likes this.
  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