<div dir="ltr"><div><div><div>Hi,<br><br></div>I have tried script:<br><br><b>["$ACTION" = "pressed" -a "$BUTTON" = "BUT_2"] && {<br> ["${ACTION}" = "ifup" -a "${INTERFACE}" = "wan"] && {<br> echo "" > /dev/console<br> echo "SWITCH TO RJ45" > /dev/console<br> echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness <br> } &<br> }<br><br></b></div><b>but still no luck :(<br><br><br></b></div><div>Could anyone please figure out what mistakes i am doing.<br><br></div><div>Regards,<br></div><div>John<br></div><b></b></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 16, 2015 at 9:12 AM, John kerry <span dir="ltr"><<a href="mailto:kerry9842@gmail.com" target="_blank">kerry9842@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi,<br><br></div>I have changed the script as below:<br><br>MYDEV='eth0.2'<br><br> ["$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" -a "INTERFACE" = 'wan'] &&<br> {<span class=""><br> devstatus "$MYDEV" | grep '"up": true' && <br> {<br> echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness <br> }<br> }<br><br><br></span></div><div>but its not working.<br><br></div><div>What mistake i am doing.<br><br></div><div>Could you please correct it me.<br><br></div><div>Regards,<br></div><div>John<br></div><div><div class="h5"><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 15, 2015 at 7:51 PM, Bastian Bittorf <span dir="ltr"><<a href="mailto:bittorf@bluebottle.com" target="_blank">bittorf@bluebottle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">* John kerry <<a href="mailto:kerry9842@gmail.com" target="_blank">kerry9842@gmail.com</a>> [15.09.2015 13:44]:<br>
<span>> Hi,<br>
><br>
> I have added following condition but its not working:<br>
><br>
> MYDEV='eth0'<br>
><br>
> if [ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" ] && {<br>
</span> ^^^^ remove the 'if'<br>
<span>> devstatus "$MYDEV" | grep '"up": true' && {<br>
> echo "255" ><br>
> /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness<br>
> }<br>
> }<br>
><br>
> fi<br>
</span> ^^^^ remove the 'fi'<br>
<br>
please change the first line to e.g.<br>
[ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" -a "$INTERFACE" = 'wan' ] && {<br>
<br>
INTERFACE is the 'name' of the device, e.g. 'wan' or 'lan'<br>
DEVICE is the real thing, e.g. eth0.1<br>
<span><br>
> Am i doing any mistake or need to change anything<br>
<br>
</span>you can always TEST you script with e.g.<br>
<br>
set -x<br>
INTERFACE=bla<br>
DEVICE=blubb<br>
. name_of_your_script<br>
set +x<br>
<br>
bye, bastian<br>
</blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div>