What's new

Solved I messed up in a user script?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

r00tb33r

New Around Here
I have a pair of OpenMesh (managed through cloudtrax) access points, in my townhome, both are wired up, and as I understand they don't integrate with my Asus RT-AC66U (the old MIPS-based variety). I ran the latest Merlin build available for the MIPS hardware.

Since I found no option to turn off the radio in the UI, I figured I'd give it a try through the shell. I SSH in and ran "radio off", which produced the desired effect. Then I looked up to see if I can put it in a script. There are user scripts.

I created a script "/jffs/scripts/services-start" and set the executable attribute:
Code:
#!/bin/sh
radio off
I rebooted the router. The radio was once again on.

I modified the script to provide the path:
Code:
#!/bin/sh
/sbin/radio off
Rebooted. The radio is on again.

I modified the script, this time adding simple debugging per the wiki.
Code:
#!/bin/sh
/sbin/radio off
touch /tmp/000test
exit 0
It seems the router did not successfully boot, as I was not able to reconnect to my machine at home (I'm at work right now).

Did I screw up in the script? When I come home, what awaits me? How do I recover if there is a problem in that script? (I don't see the problem, to be frank)
 
I have a pair of OpenMesh (managed through cloudtrax) access points, in my townhome, both are wired up, and as I understand they don't integrate with my Asus RT-AC66U (the old MIPS-based variety). I ran the latest Merlin build available for the MIPS hardware.

Since I found no option to turn off the radio in the UI, I figured I'd give it a try through the shell. I SSH in and ran "radio off", which produced the desired effect. Then I looked up to see if I can put it in a script. There are user scripts.

I created a script "/jffs/scripts/services-start" and set the executable attribute:
Code:
#!/bin/sh
radio off
I rebooted the router. The radio was once again on.

I modified the script to provide the path:
Code:
#!/bin/sh
/sbin/radio off
Rebooted. The radio is on again.

I modified the script, this time adding simple debugging per the wiki.
Code:
#!/bin/sh
/sbin/radio off
touch /tmp/000test
exit 0
It seems the router did not successfully boot, as I was not able to reconnect to my machine at home (I'm at work right now).

Did I screw up in the script? When I come home, what awaits me? How do I recover if there is a problem in that script? (I don't see the problem, to be frank)

Service-start is probably too early to call that script, call it with the latest script you can.

Not sure about what your script broke but worst case WPS reset should get rid of it (and everything else).
 
Service-start is probably too early to call that script, call it with the latest script you can.

Not sure about what your script broke but worst case WPS reset should get rid of it (and everything else).
You might be right that it's too early, although the wiki says it runs when all services had finished starting, that includes wifi, which is one of the services that can have events. I was going to try the events next, but it seems it did not boot, so I didn't get to try that. I guess I'll see if SSH is up when I get home.

I don't want to do a full reset because I have some VPN configs in there for some people. Would be a huge headache to restore. Is there anything else I can do without losing EVERYTHING?
 
You might be right that it's too early, although the wiki says it runs when all services had finished starting, that includes wifi, which is one of the services that can have events. I was going to try the events next, but it seems it did not boot, so I didn't get to try that. I guess I'll see if SSH is up when I get home.

I don't want to do a full reset because I have some VPN configs in there for some people. Would be a huge headache to restore. Is there anything else I can do without losing EVERYTHING?

Depends how bricked it is. If SSH is up then you can fix it easily. But didn't you take backups of your configs before starting to mess around?

Why not just disable the radios in the GUI? It is under wireless -> Professional (need to do it on both bands if you want them both disabled) and should survive a reboot as long as you hit "apply" after changing each one.
 
Sadly I did not back it up before I got started. In hindsight that would have been good.

I did not see a UI option to disable radios, and I looked, and looked. I looked very hard. It was very frustrating not finding it. I can't check your instructions now since it is not up. If I bring it up again, I'll check what you say. Previously I did not find it anywhere when I needed it, hence why I needed to do it though SSH. I'll be home in like 3 hours. Right now I'm just gathering suggestions on what state the router might be in and what I can do to recover.
 
I was going to try the events next, but it seems it did not boot, so I didn't get to try that. I guess I'll see if SSH is up when I get home.
It looks like service-event was first introduced in 384.5 so it's likely your 380.70 firmware doesn't have it.
 
So I in fact did not screw up in the script, my remote access application just crashed on session disconnect after multiple router reboots, the router itself was fine. I just panicked that I couldn't reconnect after router reboot.

The script did not run at all, there was no file created in /tmp/. I presume this firmware is just too old to support user scripts. But I was able to turn off the radio under the "Professional" tab. I don't know why I didn't find that before, or maybe the fact that I have to do it twice for each band threw me off. I'm all done. Going to replicate this setup at another location since I have the same router there.
 

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top