Hi Anthony,

> Due to frustrations working with Pico Lisp on MacOSX10.5 I recently  

sorry to hear that ... we obviously did not succeed to find a unified
'make' process for Mac OS.


> creating a Pico Lisp init.d script within Debian possibly with a  

I think the script can be very simple. Here is what I use (with only
slight modifications depending on the project):

################################################################
#!/bin/sh

case "$1" in
   start)
      echo "Starting Pico Lisp Application Server ..."
      su - -c xxx/run app
      (cd /home/app; bin/httpGate 80 8080)
      (cd /home/app; bin/httpGate 443 8080 xxx/pem)
      ;;

   stop)
      echo "Stopping Pico Lisp Application Server ..."
      su - -c xxx/stop app
      killall httpGate
      ;;

   *)
      eco "Usage: /etc/init.d/$0 {start|stop}"
      exit 1
      ;;
esac

exit 0
################################################################

This assumes, that a user 'app' exists on that machine, and that the
PicoLisp environment is installed in that user's home directory. That
means, when 'app' is logged in, all PicoLisp files (like "lib.l" "lib/",
"src/" or "dbg.l" are located relative to his current working directory.

The line with 'httpGate 80' can be omitted, if you want to limit access
to HTTPS (i.e. only to port 443). This is also useful if some other
process (e.g. Apache) is listening on port 80 on that machine.

To start 'httpGate' for SSL (the line with 'httpGate 443'), you need to
supply a cert file (here "xxx/pem"). This can be self-made with openssl.


The 'xxx' is the name of the project specific directory. I usually have
some start script 'run' which starts (in addition to the actual
application) a watchdog process (also in the PicoLisp release) to notify
us when a process hangs, and a password file to be used for interactive
access with "bin/psh".

################################################################
#!/bin/bash

bin/picolisp -'prinl (in "/dev/random" (rd 12))' -bye >.pw
chmod 600 .pw

bin/watchdog localhost 25 [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] 
>>log/watchdog  2>&1 &
while [ ! -p fifo/beat ]
   do sleep 1
done

./p xxx/main.l lib/app.l  -main -go -wait >>log/xxx  2>&1 &
################################################################


The 'stop' script is simpler:

################################################################
#!/bin/bash
# 17jun06abu

# Kill applications
killall -w picolisp

# Stop watchdog
test "$(ps h -C watchdog)"  &&  bin/picolisp -'out "fifo/beat" (pr)' -bye
################################################################


The whole mess is simpler than it looks at the first sight, though ;-)

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to