Boot Script (Startup Script) with Ubiquiti AirOS

I have been hitting my head against the wall trying to set the bridge priority of a few radios involved in spanning tree. It is easy to log in to the radio and change the priority with the brctl setbridgeprio br0 . But what if you want to change it on boot and automatically? I dug through the Ubiquiti forums only to find bits and pieces that lead me to the final solution.

There are a number of key files that don’t exist by default, but can be setup to provide the scripting functionality you may need.


/etc/persistent/rc.presysinit
/etc/persistent/rc.postsysinit

/etc/persistent/rc.prestart
/etc/persistent/rc.poststart

/etc/persistent/rc.prestop
/etc/persistent/rc.poststop

If you have read any of my other posts you will see that I am a huge supporter of VIM, and will assume you are using it. You can simply do vi /etc/persistent/ and then write your script. For my example, I will give you a copy of my bridge priority script:


#!/bin/sh
brctl setbridgeprio br0 7000
brctl setpathcost ath0 10

In a previous post I talked about the command that makes your /etc/ directory and changes to it persistent.


cfgmtd -w -p /etc/

This command will write the changes to /etc/ to flash and then you will be able to reboot the system and the new script will take effect. Hopefully you found this helpful.

Cheers,

-Mike

  1. No comments yet.

  1. No trackbacks yet.