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

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

wan-event script not executed

Discussion in 'Asuswrt-Merlin' started by slytho, Feb 16, 2020.

  1. slytho

    slytho Occasional Visitor

    Joined:
    Jun 16, 2013
    Messages:
    33
    Hi!

    My old wan-start worked fine. After updating to firmware .15 I renamed it to wan-event and adapted it to consider the new parameters. But it doesn't call the "wan-event-connected.user script" anymore in its code. What is wrong with the following code of the wan-event script?

    Code:
    #!/bin/sh
    
    if [ -z $2 ]
    then
      logger "Script has not received parameters, aborting."
      exit 1
    fi
    
    if [ "$2" -eq "connected" ]
    then
      . /jffs/scripts/wan-event-connected.user
    fi
    
    And running the above wan-event script on the command line by
    Code:
    sh wan-event 0 connected
    trying to simulate the parameters only produces following error:
    Code:
    : connected: bad number
     
  2. ColinTaylor

    ColinTaylor Part of the Furniture

    Joined:
    Mar 31, 2014
    Messages:
    11,025
    Location:
    UK
    Code:
    if [ "$2" -eq "connected" ]
    You're doing an arithmetic test on two strings.
     
    L&LD likes this.
  3. slytho

    slytho Occasional Visitor

    Joined:
    Jun 16, 2013
    Messages:
    33
    Aww, darn ... thank you ... changed "-eq" to "=". I overlooked that.

    Now it works ... hurray ^^