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

使用forever管理我们的app #24

Open
fallingarrow opened this issue Jun 29, 2016 · 1 comment
Open

使用forever管理我们的app #24

fallingarrow opened this issue Jun 29, 2016 · 1 comment

Comments

@fallingarrow
Copy link

About

forever能够启动,停止,重启应用

forever可以看做是一个nodejs的守护进程,使用forever启动的app在退出ssh终端之后不会结束

常用命令

  • forever start /data/github/githook

可选参数 -w 监听文件改动并自动重启服务.

  • forever stop /data/github/githook 或 任务id.
  • forever list 显示所有运行的服务
    从结果中可以看到任务的id, 任务的状态,日志文件位置,任务执行时间.

注意事项

  • forever start /data/github/githook 和forever start /data/github/githook/ 都能启动githook,然而forever会认为他们是两个不同的app.建议启动的时候不要加末尾的/
  • 可以根据list命令中的日志文件位置来找到日志并查看.也可以在start的时候通过参数 -l指定日志文件的位置.
  • 目前的任务列表
    data: uid command script forever pid id logfile uptime
    data: [0] 6v-- /usr/local/node-v6.2.1-linux-x64/bin/node /data/github/iuapfed/generate-uui 21225 21231 /root/.forever/6v--.log STOPPED
    data: [1] pQFa /usr/local/node-v6.2.1-linux-x64/bin/node /data/github/iuapfed/iuap-design.github.io 21247 9708 /root/.forever/pQFa.log 0:2:29:23.385
    data: [2] Or4L /usr/local/node-v6.2.1-linux-x64/bin/node /data/github/githook/ 495 511 /root/.forever/Or4L.log 0:0:30:55.327
@LiuYueKai
Copy link
Contributor

如果发生端口占用的情况,要先将对应的服务stop,然后再杀进程,否则会导致杀进程之后服务被重启,端口依然被占用。

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