#!/usr/local/bin/tops -s /usr/local/tops/sys -u /opt/mytops/usr/
# File lifeline, January 2005

#  Running the program as a daemon server, a lifeline to fortycoupe.

#-----------------------------------------------------------------------

   CATMSG push no catmsg

\-----------------------------------------------------------------------

\  Vector output to this log file:
   "/home/dale/lifeline.log" "LOG" book
   LOG set_sysout

   9881 "PORT" book \ lifeline port

#  Display first lines in the log file:
   "-" 80 cats nl dot nl 
   "PID " getpid int$ cat spaced date cat dot nl

#  Allow fortycoupe to connect:
   fortycoupe drop "SERVER_ALLOW" "clients" bank

#  Monitor the workload:
   "Starting WORKLOAD" . nl
    once 60 slash "WORKLOAD" PLAY \ log once a minute

#  Monitor Internet speed:
   "Starting SPEED_LOG" . nl
    once 180 slash "SPEED_LOG" PLAY 

   inline: save_index ( --- )
\     Fetch index.html from fortycoupe when topsd is
\     not running here.
      '"/tmp/index.html" asciiload remotefd remoteput'
      clientsockets 1st pry remoterun1 (hT)
      "/tmp/index.html" save
   end

#  Save index.html:
\  "Starting save_index" . nl
\  once 300 slash "save_index" PLAY

#  Start the server:
   "*" PORT DSERVER

\-----------------------------------------------------------------------

   pull catmsg

