简体   繁体   English

修改进程-PM2的“exec cwd”路径

[英]Modify the "exec cwd" path of the process -PM2

I have multiple processes that run on the server.我有多个在服务器上运行的进程。

  • Each of the processes is placed in it's own directory.每个进程都放置在它自己的目录中。
  • All of them are controlled by PM2全部由PM2控制
  • Each process is supposed to have config and ecosystem files within their folders每个进程都应该在其文件夹中包含配置和生态系统文件
  • Root folder is supposed to be empty and not related to any processes.根文件夹应该是空的,并且与任何进程无关。

One process that was set up incorrectly.一个设置不正确的进程。 I had to make it work (without touching things that do) so for this process :对于这个过程,我必须让它工作(不接触那些做的事情):

  • Pm2 show (id) indicated that the exec cwd is running from root so: pm2 show (id)表明exec cwd是从 root 运行的,所以:
  • Copy essential folders and files of the root folder复制根文件夹的基本文件夹和文件
  • Config folder, logs, other essentials had to be copied必须复制配置文件夹、日志和其他必需品

I would like to redirect the process from root to its own folder.我想将进程从根目录重定向到它自己的文件夹。 It seems I can do it simply by modifying the exec cwd but I don't know how to do it.看来我可以简单地通过修改exec cwd来做到这一点,但我不知道该怎么做。

Please help :) Cheers请帮助:)干杯

Ok well.好吧好吧。

It seems it is impossible to modify it like this as this functionality is not implemented.似乎不可能像这样修改它,因为这个功能没有实现。

Therefore:所以:

  • copy ecosystem and what you need from folder you are in to where you want it to run from将生态系统和所需内容从您所在的文件夹复制到您希望它运行的位置
  • delete the process completely彻底删除进程
  • do cd {path to your desired directory}执行 cd {路径到您想要的目录}
  • pm2 start ecosystem.config.js pm2 启动生态系统.config.js

//Additional if you want to keep the process old Id //如果要保留进程旧ID,则附加

  • pm2 kill (deletes all processes) pm2 kill(删除所有进程)
  • pm2 resurrect (restores them all with original id's) pm2 resurrect(用原始ID恢复它们)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM