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!

Scripts to set qos/bandwidth limiter to active/suspended not working.

Discussion in 'Asuswrt-Merlin' started by 000111, Jan 24, 2020.

  1. 000111

    000111 Senior Member

    Joined:
    Apr 1, 2014
    Messages:
    481
    Location:
    Florida
    Hey all, been a long time since I rapped at ya.

    I use bandwidth limiter a lot so it would be very nice to be able to script some gui actions.

    I have a script that is supposed to make the bandwidth limiter "active" or "suspended." It does not work. Here is the script:

    #!/bin/sh
    # echo $PATH | grep -q "\/sbin" || export PATH=$PATH:/sbin:/usr/sbin
    logger -p 1 -t $(basename $0) "STARTING SCRIPT, PARAMETER: $1"
    nvram show|grep qos_suspend
    nvram set qos_suspend=1
    nvram committ
    service stop_qos
    sleep 5
    service start_qos

    I have another script to do the opposite (set qos_suspend=0).
    These scripts do not work and this is what the log says when I run them:
    Jan 24 15:24:04 qossuspend.sh: STARTING SCRIPT, PARAMETER:
    Jan 24 15:24:07 rc_service: service 2081:notify_rc stop_qos
    Jan 24 15:24:12 rc_service: service 2115:notify_rc start_qos
    Jan 24 15:24:12 qos-rules: apply rules (/tmp/mangle_rules) success!
    Jan 24 15:24:12 qos-init: using wan_ifname eth0
    Jan 24 15:24:12 qos-init: bwl start complete

    Of course, setting things through the gui works and this is what the log has to say about that:
    Jan 24 15:25:12 rc_service: httpd 470:notify_rc stop_qos
    Jan 24 15:25:27 rc_service: httpd 470:notify_rc start_qos
    Jan 24 15:25:27 qos-rules: apply rules (/tmp/mangle_rules) success!
    Jan 24 15:25:27 qos-init: using wan_ifname eth0
    Jan 24 15:25:27 qos-init: bwl start complete

    I am missing something you geniuses can figure out. Help a dumb guy out today!
     
  2. dave14305

    dave14305 Part of the Furniture

    Joined:
    May 19, 2018
    Messages:
    2,137
    Location:
    USA
    Last edited: Jan 24, 2020
    000111 likes this.
  3. 000111

    000111 Senior Member

    Joined:
    Apr 1, 2014
    Messages:
    481
    Location:
    Florida
    BUT I WANTED TO STOP QOS FOR ONLY FIVE SECONDS.

    I kid. Trying the code out with just stop to turn it off and just start to turn it on now. Thanks!

    The clarification was all I needed. Qos on/off from my desktop with plink is nice. Thanks my man.

    Qos off script:

    #!/bin/sh
    # echo $PATH | grep -q "\/sbin" || export PATH=$PATH:/sbin:/usr/sbin
    logger -p 1 -t $(basename $0) "STARTING SCRIPT, PARAMETER: $1"
    nvram show|grep qos_suspend
    nvram set qos_suspend=1
    nvram committ
    service stop_qos

    Qos on script:

    #!/bin/sh
    # echo $PATH | grep -q "\/sbin" || export PATH=$PATH:/sbin:/usr/sbin
    logger -p 1 -t $(basename $0) "STARTING SCRIPT, PARAMETER: $1"
    nvram show|grep qos_suspend
    nvram set qos_suspend=0
    nvram committ
    service start_qos
     
    Last edited: Jan 24, 2020