Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Creating Servers in Rebol on Linux

 [1/8] from: webmaster:siliconspecies at: 28-Aug-2000 13:43


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? Right now, I must telnet in and run manually, if I close telnet client, server shuts down. HELP!!!!!!!!!!!!! thanks Jeff Rubin, CTO & Co-Founder Audiopia Shutup and Listen... http://www.audiopia.com also check out my personal site Brainbyte! http://www.brainbyte.com

 [2/8] from: ryanc:iesco-dms at: 28-Aug-2000 13:05


[webmaster--SILICONSPECIES--COM] 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

 [3/8] from: ryanc:iesco-dms at: 28-Aug-2000 13:46


Jeff, This one can be started and stopped. It also traps any errors in the forever loop, making it somewhat impervious. Also note the complete lack of security. --Ryan rebol [ Title: "Even More Slightly Upgraded SID Server" ] running: FALSE 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 copy "<H1>SERVER KILLED</H1>" mime close http-port quit ] "/reset" [ mime: "text/html" send-http copy "<H1>SERVER RESET</H1>" mime max-sid: "5000" ] "/start" [ mime: "text/html" send-http copy "<H1>SERVER STARTED</H1>" mime running: TRUE ] "/stop" [ mime: "text/html" send-http copy "<H1>SERVER STOPPED</H1>" mime running: FALSE ] "/" [ either running [ max-sid: form (load max-sid) + 5000 mime: "text/plain" send-http copy max-sid mime ] [ mime: "text/html" send-http copy "<H1>SERVER NOT RUNNING</H1>" mime ] ] ] forever [ error? try [ http-port: first wait listen-port request: first http-port command: second parse/all request " " do select command-list command close http-port ] ] -- Ryan Cole Programmer Analyst www.iesco-dms.com 707-468-5400

 [4/8] from: kevin:sunshinecable at: 28-Aug-2000 16:13


> How do I make the thing run resident so I can start or stop it via remote cgi? > > Right now, I must telnet in and run manually, if I close telnet client, > server shuts down.
When you start your script, you should detach it from the console so that when you log out the process continues running: The following runs a REBOL script in the background (&) and redirects stdout and stderr to the null device (1> /dev/null 2> /dev/null) so no output remains directed at the console. %./fakenews.r & 1> /dev/null 2> /dev/null Try that and see if it solves your problem. Best regards, Kev ------------------------------------------------------------------------ Kevin McKinnon, System/Network Administrator [kevin--sunshinecable--com] Sunshine Communications http://www.sunshinecable.com PGP Public Key: http://www.dockmaster.net/pgp.html PGP 6.0 www.pgp.com

 [5/8] from: christmn::clackamas::ds::adp::com at: 28-Aug-2000 17:07


This is a multi-part message in MIME format. ------=_NextPart_000_061F_01C01112.747A0090 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable You may have to put it in a shell wrapper using nohup and putting it in background. The telnet session sends a HUP signal on disconnect and this is killing your server. You can also put the shell script in the boot startup directory with start/stop args then write your cgi to execute the script with a stop or start directive. ----- Original Message ----- From: [kevin--sunshinecable--com] To: [list--rebol--com] Sent: Monday, August 28, 2000 4:13 PM Subject: [REBOL] Creating Servers in Rebol on Linux Re:
> How do I make the thing run resident so I can start or stop it via remote cgi? > > Right now, I must telnet in and run manually, if I close telnet client, > server shuts down.
When you start your script, you should detach it from the console so that when you log out the process continues running: The following runs a REBOL script in the background (&) and redirects stdout and stderr to the null device (1> /dev/null 2> /dev/null) so no output remains directed at the console. %./fakenews.r & 1> /dev/null 2> /dev/null Try that and see if it solves your problem. Best regards, Kev ------------------------------------------------------------------------ Kevin McKinnon, System/Network Administrator [kevin--sunshinecable--com] Sunshine Communications http://www.sunshinecable.com PGP Public Key: http://www.dockmaster.net/pgp.html PGP 6.0 www.pgp.com ------=_NextPart_000_061F_01C01112.747A0090 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 5.50.4134.600" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT size=2>You may have to put it in a shell wrapper using nohup and putting it in background. The telnet session sends a HUP signal on disconnect and this is killing your server. You can also put the shell script in the boot startup directory with start/stop args then write your cgi to execute the script with a stop or start directive.</FONT></DIV> <BLOCKQUOTE style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV> <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> <A title=[kevin--sunshinecable--com] href="mailto:[kevin--sunshinecable--com]">[kevin--sunshinecable--com]</A> </DIV> <DIV style="FONT: 10pt arial"><B>To:</B> <A title=[list--rebol--com] href="mailto:[list--rebol--com]">[list--rebol--com]</A> </DIV> <DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, August 28, 2000 4:13 PM</DIV> <DIV style="FONT: 10pt arial"><B>Subject:</B> [REBOL] Creating Servers in Rebol on Linux Re:</DIV> <DIV><BR></DIV>> How do I make the thing run resident so I can start or stop it via remote cgi?<BR>> <BR>> Right now, I must telnet in and run manually, if I close telnet client, <BR>> server shuts down.<BR><BR>When you start your script, you should detach it from the console so <BR>that when you log out the process continues running:<BR><BR>The following runs a REBOL script in the background (&amp;) and redirects <BR>stdout and stderr to the null device (1> /dev/null 2> /dev/null) so <BR>no output remains directed at the console.<BR><BR>%./fakenews.r &amp; 1> /dev/null 2> /dev/null<BR><BR>Try that and see if it solves your problem.<BR><BR>Best regards,<BR>Kev<BR><BR>------------------------------------------------------------------------<BR>Kevin McKinnon, System/Network Administrator&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:[kevin--sunshinecable--com]">[kevin--sunshinecable--com]</A><BR>Sunshine Communications&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="http://www.sunshinecable.com">http://www.sunshinecable.com</A><BR
><BR>PGP
Public Key: <A href="http://www.dockmaster.net/pgp.html">http://www.dockmaster.net/pgp.html</A>&nbsp;&nbsp; PGP 6.0 <A href="http://www.pgp.com">www.pgp.com</A><BR><BR></BLOCKQUOTE></BODY></HTML> ------=_NextPart_000_061F_01C01112.747A0090--

 [6/8] from: webmaster:siliconspecies at: 28-Aug-2000 20:44


nope when i do that it runs the server but the html calling page just waits and waits as it tries to contact the server i also tried just the & without the null stuff and it does the same thing At 04:13 PM 8/28/00 -0700, you wrote:
> > How do I make the thing run resident so I can start or stop it via > remote cgi?
<<quoted lines omitted: 14>>
>Sunshine Communications http://www.sunshinecable.com >PGP Public Key: http://www.dockmaster.net/pgp.html PGP 6.0 www.pgp.com
Jeff Rubin, CTO & Co-Founder Audiopia Shutup and Listen... http://www.audiopia.com also check out my personal site Brainbyte! http://www.brainbyte.com

 [7/8] from: kevin:sunshinecable at: 28-Aug-2000 19:23


On Mon, 28 Aug 2000 [webmaster--SILICONSPECIES--COM] wrote:
> nope when i do that it runs the server but the html calling page just waits > and waits as it tries to contact the server > > i also tried just the & without the null stuff and it does the same thing
You say the server runs. What happens if you try to telnet into the port that the server is bound to? ie: %telnet localhost 80 ...if the server is bound to the standard http port. Does your server script respond in the manner you are expecting? Kev

 [8/8] from: webmaster:siliconspecies at: 31-Aug-2000 15:28


best bet was starting the thing as a cron thanks for the help! Jeff Rubin, CTO & Co-Founder Audiopia Shutup and Listen... http://www.audiopia.com also check out my personal site Brainbyte! http://www.brainbyte.com

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted