modified on 9 May 2011 at 20:59 ••• 8,039 views

Linux Script FAQ

From Ubiquiti Wiki

Jump to: navigation, search

FAQ

Q: What's a linux script?
A: A text file where each line it's a linux command like you enter in CLI like:

#! /bin/sh
route add -net 10.10.10.0 netmask 255.255.255.0 gw 192.168.2.101 dev eth0

Q: How to make the script file /etc/persistent/rc.poststart?
A1: Use the embedded text editor in AirOS device, the vi editor: vi /etc/persistent/rc.poststart. To save this file press [ESC] [:] [x]
or
A2: Make file rc.poststart on you PC and upload in AirOS device, in the /etc/persistent/ directory...

Q: How to check if a file have executable permission (under Linux)?
A: Run command ls -l and check if the file have x option enabled:

XS2.ar2316.v3.4-rc.4351.090504.2146# ls -l /etc/persistent/rc.poststart
-rwxr-xr-x    1 admin    admin           6 May 16 16:32 /etc/persistent/rc.poststart

Q: How to simply enable executable permission of a file (under Linux)?
A: Run command like: chmod +x /etc/persistent/rc.poststart

XS2.ar2316.v3.4-rc.4351.090504.2146# chmod +x /etc/persistent/rc.poststart