Using Source Files in JNOS


Source Files and the Autoexec.nos File

Over time, the autoexec.nos file can become a huge rambling assemblage of comments and commands, nearly incomprehensible to the sysop who so carefully put it together when first getting JNOS up and running. Somehow, this file just seems to gracefully decay as more system tests are performed or more new functionality added.

What can you do to fight these "forces of disorder?" The answer is to use smaller dedicated files that are "sourced into" the autoexec.nos runtime configuration file.

The advantage is that you can "modularize" your data commands, thus leaving a much smaller and more readable exec. This config file now becomes a top level file with the "call outs" to the source files, also known as scripts, making up the lower levels. Each file can be dedicated to a particuar task, or to a particular piece of hardware. (A further benefit is the ease with which you can clone or change these files in a text editor or the stream editor, i.e., sed, or "enable/disable" an entire source file by commenting the source command "in" or "out.")

The only disadvantage that I have seen is that it can sometimes be harder to find an item located inside a group of files. You have to name your source files descriptively, or know how to use grep. However, on a Linux system, this should not be a problem.




A Typical Source File Example:

To call in, or include, the data in a source file, you use the source command in the autoexec.nos file, for example:

  • source /jnos/scripts/mysourcefile
Where the top level directory for JNOS is named "jnos," the directory for your source scripts is named "scripts," and the particular source file is here named as "mysourcefile." If yours differs, then adjust the command line as needed.

The excerpted file below is referenced, or called out, in the autoexec.nos as:

  • source /jnos/scripts/do_vhf
Essentially, the file below named "do_vhf" is inserted at that point into the config file. As you can see the "theme" for this file is the ax2 interface data and all the information that pertains to that interface. This is a convenient way to keep all this data together in one place.

NOTE: I have left this file exactly as is, leaving in comments and other reminder notes, and even previous commands, that may have been modified over time...

Excerpt from file do_vhf:

# VHF script for ax2 on COM4
# (08-19-00: KPC3 on freq 145.630)
# NOTE: Shifted this freq, I lost a handi and had to make some changes!
# 04-23-03: KPC3 now using 145.070
# 06-03-03: Now on COM4
#
# attach asy ttyS2 - ax25 ax2 1024 256 9600 ( Was COM3 )
# NOTE: Want to move this to ttyS1 or COM2
#
attach asy ttyS1 - ax25 ax2 1024 256 9600
# attach asy ttyS3 - ax25 ax2 1024 256 9600
#
#----- Configs...
ifc ax2 linkaddress ka1fsb-7
ifc ax2 ax25 bctext "JNOS/Linux 1.11f [44.56.26.11] 14.105<>145.070, Wellesley, MA"
ifc ax2 netmask 0xffffff00
ifc ax2 broadcast 44.56.26.255
ifc ax2 ax25 maxframe 1
# ifc ax2 ax25 paclen 256
# Changed 04-19-02
ifc ax2 ax25 paclen 128
ifc ax2 ax25 t2 400
# ifc ax2 tcp mss 108
# ifc ax2 tcp win 216
ip hp ax2 on
# ifconfig ax2 descr " VHF port on 145.630 KPC3   TNC 1200 baud (WC1ABL-7, MEMA)"
#ifconfig ax2 descr " VHF port on 145.630 KPC3   TNC 1200 baud (MASS:W1UU)"
ifconfig ax2 descr " VHF port on 145.070 KPC3   TNC 1200 baud (DEDHM1:W1JLI-7)"
# ifconfig ax2 descr " VHF port on 145.090 KPC3  TNC 1200 baud"
#
#----- TNC params...
#      May already be burned into the kcp3
param ax2 1 20       # TXdelay was 25
param ax2 2 63       # Persist
param ax2 3 10       # slot
param ax2 4 10       # TX tail was 5
param ax2 5 0        # Half Duplex
# param ax2 dtr 1
# param ax2 rts 1
#
ax25 bcport ax2 on
ax25 digipeat ax2 on
#mode ax2 datagram
mbox hideport ax2 off
trace ax2 311
#
#----- Arps
arp publish 44.56.26.14 ax25 ka1fsb-7 ax2
arp publish 44.56.26.11 ax25 ka1fsb-7 ax2
arp publish 44.56.26.10 ax25 ka1fsb-7 ax2
arp add 44.52.9.1 ax25 W1FJE-11 ax2
arp add 44.56.20.1 ax25 W1UU ax2
#
#----- Routes...
#      02-08-01: changed to .1 (direct) instead of .8!
#      Added a source file 02-10-01: kbn
source /jnos/spool/sources/vhf_routes
# route add 44.56.26.1 ax2
# route add default ax2 44.56.26.1
# route add 44/8 ax2 44.56.26.1
# route add 44.56.26.0/24 ax2 44.56.26.1
#
#----- ax25 routes
#----- Was mema
# ax25 route add w1fje-11 ax2 mema
#
#----- Tom's w1fje, net.ipnh.ampr.org
route add 44.52.9.1 ax2
#----- Set up a general catch all for NH
# route add 44.52.9.0/24 ax2 44.52.9.1
#
#----- Peter's w1uu
route add 44.56.20.1 ax2
route add 44.56.20.0/24 ax2 44.56.20.1
#----- Was mema
# ax25 route add w1uu ax2 mema
ax25 route add w1uu ax2 w1jli
#
# End of do_vhf
      Mail Document Request for:   do_vhf
  A Few Caveats:

  • Be sure your local mailer is properly "hooked" into your browser.
  • Allow up to 24 hours for delivery, although 3-6 is typical...
  • Mailed copy, being the latest "on-line" version, may differ slightly from above.
  • Click on "Mail it to me" below to activate your mailer, then send from there.
  • Please don't change the subject field. (Additional text body comments OK.)
  • Sometimes server is down for extended periods of time... (1-10+ days)
  • (You obtain, modify and run all data/code at your own risk.)


Enough "excuses," just Mail it to me!

  What if ...

  • If your browser-linked mailer doesn't seem to respond, you may send a null-bodied email to ka1fsb@att.net with a subject of "Code Request - do_vhf" not including the quotes... (Some browsers and their mail agents do not like excessive string data in the mailto format.)



(Courtesy KBNorton Computer Services)