Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

請問如何在開機的時候就啟動多個node.js腳本 on linux #8

Open
e314520513 opened this issue Jun 25, 2016 · 1 comment
Open

Comments

@e314520513
Copy link

遇到的問題

請問如何在開機的時候就啟動多個node.js腳本 on linux

我把指令寫在/etc/rc.local 但只會啟動 node /var/www/nodeJs/todoList/bin/www
下面的都不會啟動

/etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
node /var/www/nodeJs/todoList/bin/www
node /var/www/nodeJs/chatroom/app.js
exit 0
@poying
Copy link

poying commented Jun 25, 2016

@e314520513 提供幾種方法給你參考:

  1. 使用 nohup,我覺得最簡單的方式。nohup node /var/www/nodeJs/todoList/bin/www &
  2. pm2,不需要修改 js 程式碼
  3. deamon.node,需要修改 js 程式碼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants