WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: node.js http-server  (Read 3398 times)

Offline m3tr0g33k

  • Newbie
  • *
  • Posts: 2
node.js http-server
« on: April 17, 2014, 01:02:43 PM »
Hi All,

Noob to tinycore, but not unixes in general.
I have successfully got node.js and http-server extension running.
BUT - I am running my pi headless, just over ssh.
I can start the http-server with

sudo .npm/http-server/0.6.1/package/bin/http-server public -p80

but even when I background it (with & appended or with ctrl-z; bg) as soon as I break the ssh connection, the node process dies.

I have tried adding the full command line:

/home/tc/npm/http-server/0.6.1/package/bin/http-server public -p80

to /opt/bootlocal.sh, but the process is not running once boot is complete.

Anyone any ideas where I should put this so that it starts on boot?

Thanks in advance.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1063
Re: node.js http-server
« Reply #1 on: April 18, 2014, 09:59:34 AM »
Hi All,

Noob to tinycore, but not unixes in general.
I have successfully got node.js and http-server extension running.
BUT - I am running my pi headless, just over ssh.
I can start the http-server with

sudo .npm/http-server/0.6.1/package/bin/http-server public -p80

but even when I background it (with & appended or with ctrl-z; bg) as soon as I break the ssh connection, the node process dies.

I have tried adding the full command line:

/home/tc/npm/http-server/0.6.1/package/bin/http-server public -p80

to /opt/bootlocal.sh, but the process is not running once boot is complete.

Anyone any ideas where I should put this so that it starts on boot?

Thanks in advance.

It is probably because it is trying to output logging info to the console.   Does this program have a command line option to start as a daemon?   If not, then try to re-direct the output to a log file or the null device.   (Probably best to log the output at first)

Put this in bootlocal.sh

/home/tc/npm/http-server/0.6.1/package/bin/http-server public -p80 2>&1 > /tmp/http.log &

Offline m3tr0g33k

  • Newbie
  • *
  • Posts: 2
Re: node.js http-server
« Reply #2 on: April 18, 2014, 02:07:03 PM »
Star effort - thanks, Paul_123!
That has sorted running from the ssh conneciton in the shell.
Ages since I've run headless machines (probably booting on an RS232 console cable) and that had not occurred to me.
I'll give it a try over a reboot later.

the site is www.erge.co