[EMAIL PROTECTED] wrote:

> I asked this before to no avail.
>
> The SID-SERVER from the Official Guide or any server for that matter
> created in Rebol and to be run on Linux.
>
> How do I make the thing run resident so I can start or stop it via remote cgi?

What is the best way to peel an orange?  Numerous ways come to my mind. First is
just to do what your trying to do, the manual way with telnet.

Another way is to have the server either stop taking requests either upon special
command either quiting or waiting for the "on" command.  And yet another way would
be to have the server not take requests between a certain time periods.

Your decision just depends really on what you want it to do in the grand scheme of
things. I will be kind and give an example to play with.

rebol [
    Title: "Slightly Upgraded SID Server"
]

listen-port: open/lines tcp://:8080
max-sid: "5000"
send-http: func [data mime] [
  insert data rejoin ["HTTP/1.0 200 OK^/Content-type: " mime "^/^/"]
  insert http-port data
]

command-list: [
  "/kill" [
     mime: "text/html"
     send-http "<H1>SERVER KILLED</H1>" mime
     close http-port
     quit
  ]
  "/reset" [
    mime: "text/html"
    send-http "<H1>SERVER RESET</H1>" mime
    max-sid: "5000"
  ]
  "/" [
    max-sid: form (load max-sid) + 5000
    mime: "text/plain"
    send-http copy max-sid mime
  ]
]

forever [
  http-port: first wait listen-port
  probe request: first http-port
  command: second probe parse/all request " "
  do select command-list command
  close http-port
]


>
> Right now, I must telnet in and run manually, if I close telnet client,
> server shuts down.
>
> HELP!!!!!!!!!!!!!

Hmmm...  I have never run into this.  Probably your telnet server.  Are you logged
in as root?
Try another telnetd maybe.  Good question for a Linux newsgroup.

Anyways, have fun,

--Ryan

Ryan Cole
Programmer Analyst
www.iesco-dms.com
707-468-5400


Reply via email to