What's new

Help With Custom Scripts

  • 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!

Kim Puleston

Regular Contributor
Hello all,

I am breaking into the world of custom scripts for my Asus Router AC88U. Now reading some of the Tutorials on how to setup various functions such as Adblock make sense but for one part, actually adding the scripts to particular directories in JFFS.

For example I may get asked to place a script in ''Wan-Start'' but how do I do that via an SSH terminal ? Do I need to browse to that directory before inputing a script ?

As below

''
Virtual Interface
Next we create a virtual interface with 192.168.1.3. This need to be performed on every boot (or more precisely every time the WAN interface comes up). Hence, append the following two lines to your /jffs/scripts/wan-start:

ifconfig br0:pixelserv 192.168.1.3 up
logger -t $(basename $0) "br0:pixelserv 192.168.1.3 created."
''
Exactly what commands within SSH do I need to use in order to browse to specific directories on the router ?

Thanks all.
 
What you are really asking is 'How do I use linux?' Best bet is to do a web search on 'Linux basic commands' and start reading :)

The built in editor is called vi, and starting with 380.62 Nano editor is also included. More searches and reading.....
 
I figured it would be a case of that. When you say the built in editor...is that I am using when I am using Putty to SSH into the router ?

I have been using Putty to access the router all this time, is there another way I should be going about this ?

Sorry for the Ignorance.
 
Last edited:
I figured it would be a case of that. When you say the built in editor...is that I am using when I am using Putty to SSH into the router ?

I have been using Putty to access the router all this time, is there another way I should be going about this ?

Sorry for the Ignorance.

No when you use putty to ssh into the router you are put in a shell(kind of like a command prompt in Windows) and from there you can execute the built in editor nano or vi.
 
Thanks guys, big help. I will have to look up the command when in SSH to invoke one of the editors or give Winscp a go.
 
Thanks guys, big help. I will have to look up the command when in SSH to invoke one of the editors or give Winscp a go.

The basics for script editing. Once connected over SSH:

Code:
nano -w /jffs/scripts/whatever-script

While editing, to save the file:

Code:
Ctrl-O

it will ask you to confirm the filename, press enter to keep the existing filename.

To exit from nano:

Code:
Ctrl-X

Remember that all scripts (NOT config files) must begin with a shebang. The first line must be:

Code:
#/bin/sh

This tells Linux how to execute the script (in this case, it's a shell script, so it runs through "sh". A Perl script would have "perl" in that line, for example).
 
Thanks guys. WinSCP seems like a good one. Just out of interest I notice I can open txt files in WinSCP, edit them and then save them. Is it ok to do this with existing plain txt files and use Notepad++ to create new files ?
 
Thanks guys. WinSCP seems like a good one. Just out of interest I notice I can open txt files in WinSCP, edit them and then save them. Is it ok to do this with existing plain txt files and use Notepad++ to create new files ?
You can use either editor for both tasks. WinSCP comes with a built-in edit which is just fine. Notepad++ is a separate product with more features which integrates well with WinSCP. The choice is yours.
 
Now reading some of the Tutorials on how to setup various functions such as Adblock make sense but for one part, actually adding the scripts to particular directories in JFFS.
I'll just drop this line here.
There's an easy and a hard(er) way to add ad blocking to your router...
 
I'll just drop this line here.
There's an easy and a hard(er) way to add ad blocking to your router...

Yes! AB-Solution by thelonelycoder is the easy way. :)

The OP wants to learn to script though. ;)

Must be nice to have time on his hands. :D
 
Must be nice to have time on his hands.
If I hadn't started this all, I would actually have time to learn coding and play with Unix stuff...
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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