HN Clone On Free AWS EC2: How To Keep It Running After The SSH Session Is Closed

March 2, 2013 10:13 am

I tried creating a HN Clone based on these steps:

It is a great step-by-step tutorial, and within 10-15 minutes, I had the HN clone up and running. Except for one problem.

Basically these three steps are required to get “ready to serve port 8080”:

$ mzscheme -f as.scm
arc> (load “news.arc”)
arc> (nsv)

The issue is, once the terminal session is closed, in spite of the running EC2 instance, 8080 does not respond. (it works fine as long as the ssh is running)

How do I get this to run in the background AFTER the ssh is terminated? Shd i place these commands in some instance startup or something? How do I do it?

That was a question I struggled for some time to find the answer for – so here it is: (picked up from this long thread on arclanguage forum)

Basically you need to cd to the arc directory, and do a screen on mzscheme. and then, in the window that opens, you can type out the load and nsv. Then do a Ctrl- A D to detach the screen.

YOu are done. Even when the terminal is closed, since screen executes as a separate thread, you are good. you can resume by typing screen -r on the terminal any time.

(There should be cleaner alternatives, like including this in a startup script or something, but for now, this works)

For Interesting Statistics Everyday, Find Statspotting on Facebook and Follow Statspotting on Twitter

Leave a Reply