/usr/lib/picolisp/bin/replica is in picolisp 15.11-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/usr/bin/picolisp /usr/lib/picolisp/lib.l
# 20nov15abu
# Use: bin/replica <port|num> <keyFile> <journal> <dbFile> <blob/app/> [dbs1 ..]
# : bin/ssl <host> 443 '<port|name>/!replica' <keyFile> <journal> <blob/app/> 20 [60]
(load "@lib/misc.l" "@lib/http.l")
(allow "!replica")
(argv *Arg1 *KeyFile *Journal *Pool *Blob . *Dbs)
(unless (info *KeyFile)
(bye) )
(setq
*Arg1 (format *Arg1)
*Port (or (format (sys "PORT")) *Arg1)
*SSLKey (in *KeyFile (line T)) )
(de replica ()
(protect
(when (= (line T) *SSLKey)
(let? X (line T)
(if (format X)
(when (out (tmp 'replica) (echo @)) # Journal
(prin (peek))
(flush)
(journal (tmp 'replica)) )
(let Blob (pack *Blob X) # Blob
(call 'mkdir "-p" (dirname Blob))
(out Blob (echo)) ) ) ) ) ) )
(pool *Pool (mapcar format *Dbs) *Journal)
(retire *Arg1)
# Non-forking server
(setq *Port (port *Port))
(loop
(http (setq *Sock (listen *Port)))
(close *Sock) )
|