deployd + tail -- HOWTO
=======================

Two small AmigaOS Shell tools, written by hand in C (vbcc) by Timo
Schweda for Rebound Retro Lab.

  deployd 1.0.0-beta   starts a program as soon as it is deployed
  tail    1.0.0        follows a growing text file, like Unix tail -f

Source code and the story behind them: the Workbench pages on
https://rebound-retro-lab.com


Requirements
------------

AmigaOS 2.0 or newer (both use dos.library V36 calls), 68k.
deployd has been used on Amiberry and on an Apollo A6000; tail on
Amiberry.


Installing
----------

Copy the executables somewhere in your Shell's path, for example C:

  copy deployd C:
  copy tail C:

(In the Workbench ZIPs they live in <project>/build/.)


deployd
-------

  deployd [runonce] [debug] [-h] -p PATH

  -p PATH   the drawer or volume to watch (required)
  runonce   look once, then quit
  debug     more output, and deploy.txt is NOT deleted (see below)
  -h        show the usage line

deployd checks PATH roughly every 1.2 seconds for a file called
deploy.txt. When it finds one, it:

  1. reads the first line -- the command to run,
  2. deletes deploy.txt,
  3. starts the command as its own process, in the background,
  4. goes back to watching.

Ctrl-C in its Shell window stops it.

Things to know:

  * The command runs in deployd's CURRENT directory. Start deployd
    from inside the drawer it watches, or a bare program name in
    deploy.txt will not be found:

      cd Personal:Sources
      deployd -p Personal:Sources

  * The command line can be at most 118 characters.

  * The started program gets no keyboard input (NIL:). Its output
    goes to deploy.log in the watched drawer, appended, each run
    headed by a "--- new application deployed: ... ---" line.
    deploy.log keeps growing; delete it whenever you like.

  * In debug mode deploy.txt stays where it is, so the same command
    is started again every round. Use it to look, not to work.

  * Give deployd its own Shell window. That keeps Ctrl-C simple.


Using deployd with Rebound Retro Studio
---------------------------------------

Studio copies your built program first and publishes deploy.txt
second, so deployd never starts a half-written file.

  Amiberry / FS-UAE  Set a deploy directory in Studio: a folder on
                     your Mac that the emulated Amiga sees as a drive.
                     In the emulator, cd into that drive and start
                     deployd watching it. Run in Studio (Cmd+R) then
                     starts your program inside the running emulator.

  Apollo             Studio sends the program and deploy.txt to the
                     deploy drawer over ApolloExplorer, which must be
                     running on the Apollo. The drawer is
                     Personal:Sources unless you changed it in Studio's
                     Settings > Machine. Start deployd there:

                       cd Personal:Sources
                       deployd -p Personal:Sources

Program arguments go in Studio's Settings > Target; they end up on
the same line in deploy.txt.


Using deployd without Studio
----------------------------

Copy the program into the watched drawer FIRST, then write
deploy.txt under another name and rename it, so deployd never sees a
half-written file:

  copy myprog Personal:Sources/
  echo >Personal:Sources/deploy.txt.tmp "myprog arg1 arg2"
  rename Personal:Sources/deploy.txt.tmp Personal:Sources/deploy.txt


tail
----

  tail [-h] FILE

tail prints the last part of FILE (up to 2 KB), then everything that
is appended to it. If the file gets truncated it prints
"--- file got truncated ---" and carries on from the new end.
It sleeps while nothing changes. Ctrl-C stops it.

With deployd, watch your program's output in a second Shell:

  tail Personal:Sources/deploy.log


Building from source
--------------------

Each Workbench ZIP is a Rebound Retro Studio project: open the folder
in Studio and build. Both include AmigaOS headers (dos, exec), so
Studio needs the AmigaOS NDK 3.2: Preferences > vbcc > "AmigaOS NDK
headers" -- choose your Include_H, or let Studio download it.

--
Packaged from amiga commit 6089dc2.
