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

  • Home
  • SEARCH
  • 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 6367945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:36:47+00:00 2026-05-25T00:36:47+00:00

I have a nodejs server that executes commands through child_process.exec. One such command restarts

  • 0

I have a nodejs server that executes commands through child_process.exec. One such command restarts the node instance (and a couple of other things).

The script does something like this:

  • kill node
  • kill programs node uses
  • clear logs
  • restart programs node uses
  • restart node

I know this is not the best way of doing it, but my hands are tied (it’s a released version of software and we can’t restructure until the next release).

What’s happening is that when I run the command, it kills node and then the rest of the script dies.

The default shell that node is using is sh, and that cannot be changed.

What are my options?

The server is running as root, so there won’t be any permissions problems. I figure I’ll have to start a new shell somehow, but I’m not entirely sure how to do that. I’d like to exit the current shell successfully, but that isn’t a requirement, as long as I can get the an entire script separate from the current shell.

  • 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-25T00:36:47+00:00Added an answer on May 25, 2026 at 12:36 am

    After much toil and heartbreak, this is the pattern of what succeeded:

    • echo script > /dev/shm/filename
    • chmod +x /dev/shm/filename
    • nohup /dev/shm/filename

    Then in the script:

    killall node

    This is a pretty low-tech way of solving the problem and of course not optimal, but it works. Since nohup was used, it will not die when the parent dies. This means that all of the scripts will run.

    It also turned out that I had another error that complicated things, which has since been fixed.

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

Sidebar

Related Questions

I have our first NodeJS server that's being deployed to a client server along
I have a java JAR file that is triggered by a SQL server job.
I have 3 home PCs that have 2008 SQL Server Express instances installed on
I have a script that appends some rows to a table. One of the
I have installed a program called node.js on my server to listen on port
What i want to be able to do is have a server which one
Assume that we have N erlang nodes, running same application. I want to share
I'm writing a Java Tree in which tree nodes could have children that take
Is it possible to use XPath to select only the nodes that have a
I have several templates that match various nodes in an xml document. If I

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.