Deploying a TINI program with command and batch files

TUTOR HOME
PREVIOUS
TIPS HOME
NEXT
HELP BUY CONTACT ABOUT

Typically, I use JBuilder with the TiniTools plug-in which automatically converts and ftp uploads a .tini program file. However, there are times (such as using the 1-Wire API with TINI 1.01) in which you need to run a build batch file, or you need to deploy multiple files to TINI after a build (a .tini and a matching .startup file for example). I use a combination of DOS path batch files, ftp command files, and command line parameters. Here's an example taken from some 8x1-Wire I/O board sample code. These files are contained in the source code zip files here.

The ftp batch file

@echo off
if "%1" == "" goto usage
if "%2" == "" goto usage

echo Will ftp to %1 using %2.cmd

rem ftp -s:%2.cmd %1
ftp -s:%2.cmd %1
goto end

:usage
echo Usage: deploy {TINI hostname} {.tini file} such as "deploy 166.70.144.45 leds"
echo Uses separate .cmd files for each option such as leds.cmd
echo Will deploy a .startup file for each option such as .startup.leds

:end

This batch file is invoked with the IP address at which to deploy, and the name of the program to deploy. Note that you must use the same name for your .tini file and the .cmd file, as well as the .startup file. In this case, my TINI file is "leds.class", the command file is "leds.cmd" and the .startup file for leds is ".startup.leds"

If you are interested in the Linux script for automating FTP

echo "user root tini" > f
echo "bin" >> f
echo "put "$1"">> f
cat f | ftp -n -v $2
rm f

The command line looks like this

goftp myapp.tini 192.168.1.2

This works under Redhat 6.0. Other versions of Linux have not been
tested.

- thanks to Tom Chenot -

An ftp command file
root
tini
bin
put classes/leds.tini
put .startup.leds etc/.startup
close
quit
This is the "leds.cmd" file

A .startup file
########
#Autogen'd slush startup file
setenv FTPServer enable
setenv TelnetServer enable
setenv SerialServer enable
##
#Add user calls to setenv here:
##
initializeNetwork
########
#Add other user additions here:
java /leds.tini > leds.txt
This is the ".startup.leds" file. Note the spaces surrounding the > redirection character. More tips on redirection.