Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6657845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:49:14+00:00 2026-05-26T01:49:14+00:00

im runnig an http server using nodejs. i want also the server to run

  • 0

im runnig an http server using nodejs. i want also the server to run forever, even when my machine restarts,i want node to run again upon restart. so i created a script to put in the

/etc/init.d/

here is the script

#! /bin/sh -e
set -e
PATH=/usr/local/bin/node:/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/opt/node-v0.4.7/examples/app.js
case "$1" in
start) forever start $DAEMON ;;
stop) forever stop $DAEMON ;;
force-reload|restart)
forever restart $DAEMON ;;
*) echo "Usage: /etc/init.d/node {start|stop|restart|force-reload}"
exit 1 ;;
esac
exit 0

however when i run

/etc/init.d/node 

i keep getting the same error saying

/etc/init.d/node: 13: Syntax error: word unexpected (expecting “)”)

can you guys see the error ? i’m sure it’s probably some easy syntax error but it’s kinda late and i’m really tired.
thanks for the help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:49:15+00:00Added an answer on May 26, 2026 at 1:49 am

    You can create upstart service in Ubuntu(if you use it).
    Create myapp.conf in /etc/init and write something like:

    start on startup
    respawn
    exec node /path/to/your/script.js
    

    Then your app will start after reboot and you can manage it via start and stop commands.
    And look at forever node.js module

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following simple http server using Node.js: var http = require('http'); var
I am running a subversion server with access via http using webdav. I have
Using the client and server examples found here: http://www.winsocketdotnetworkprogramming.com/winsock2programming/winsock2advancedmailslot14.html Compiling them with VS2008, running
I am running a HTTP server on my development machine. I have a website,
I am running IIS and Apache HTTP Server side-by-side on my localhost machine, and
I've followed the guide on Heroku's website to get a node server running using
Here's my problem: I have server A, running node.js and using socket.io for communicating
To learn c++11 (and boost) I am writing a simple http-server using boost asio
I am using apache as my front http server which handles requests for JBoss
My node.js server is making a call to another server using the latest (0.4.8)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.