How to run as background process?

Exiting the IDE window does not terminate the container, but it does terminate the process running in the terminal. To avoid this, you should run it as a background process.

There are 2 options to set-up;

  1. Run in the background setting (recommanded!)

  2. Use nohup command

1. Run in the background setting

Enter the execution command in the script, then tap the Run in the background checkbox to run the command.

command tap > Run > click right on wanted run command > setting > check Run in the backgound > Save and run

2. Use nohup command

1. How to run

  • Prepare a file(ex. a.out) that you want to run in a background process.

  • Type the command

# nohup <absolute path>/a.out &
  • You can check for execution with the command below.

 # ps -aux | grep a.out

2. How to end

  • After finding the PID value with the ps command, end the process with the kill command.

# ps -ef | grep a.out
# kill -TERM PID number

※ Note: nohup command automatically creates a file called nohup.out.

This file records the output of the commands you run with nohup.

If you don't want to create this file, you can have it output to /dev/null.

# nohup echo hello > /dev/null

If you are using node app

You can simply run it as a background process using the forever command in the npm package.

1. How to run

  • Install forever

$ npm install -g forever
  • Run the app with the command below

$ forever start app.js
  • You can verify whether it's running or not with the command below.

$ forever list

For detailed usage, please refer to forever usage.

Last updated