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

Using PM2 to manage all processes #1776

Closed
calebmer opened this issue Nov 17, 2015 · 13 comments
Closed

Using PM2 to manage all processes #1776

calebmer opened this issue Nov 17, 2015 · 13 comments

Comments

@calebmer
Copy link

I want to use PM2 to manage all of my processes, even non node ones. I have some processes written in Haskell and Go (which are compiled) and run in a bash environment. Does PM2 accommodate this use case?

@ravi
Copy link

ravi commented Nov 18, 2015

Yes, you can use PM2 in fork mode with exec interpreter set to none.

@calebmer
Copy link
Author

@ravi With exec_interpreter set to bash, the restart and stop commands fail, is this to be expected?

@ravi
Copy link

ravi commented Nov 24, 2015

Are you running a bash script? Try setting it to none, I think.

@calebmer
Copy link
Author

Yep. That works.

@dgreene1
Copy link

Is there an example of this somewhere?

@atrauzzi
Copy link

Yeah, wondering if there's any documentation that could be added for non-node executables.

@soyuka
Copy link
Collaborator

soyuka commented Apr 13, 2017

@barbalex
Copy link

and how would I pass this binary a file it needs?

For instance I would start my postgrest (https://github.com/begriffs/postgrest) server like this:

./postgrest postgrest.conf

postgrest.conf is a configuration file that postgrest needs.

When I do

pm2 start ./postgrest postgrest.conf

the process errors out.

So how should I pass this file to postgrest?

@vmarchaud
Copy link
Contributor

@barbalex you should use pm2 start ./postgrest -- postgrest.conf, -- is needed to tell PM2 that you want to define arguments for the process and not for PM2 itself

@barbalex
Copy link

@vmarchaud Thanks a lot. For your answer and most of all for helping build this great tool.

Somehow I missed that important detail in the documentation. It probably is there but as someone not much into this matter I guess I just did not know how to search correctly.

Maybe this is a general way to do this sort of thing in node and that is why it is not mentioned in the pm2 docs? If so I would plead to add this example for all the poor frontend folks like me ;-)

@vmarchaud
Copy link
Contributor

@barbalex It's documented there (second line), but it's common for unix tools to use -- as a indicator to stop parsing arguments.
For example, if you want to ls on a file called -a, you can't run ls -a because thats an option, you need to use ls -- -a :)

@barbalex
Copy link

@vmarchaud thanks a lot for clarifying that. So it's true that this is a catch for noobs like me who think this may be a node thing when it really is unix ;-)

Any way I offered clarifying this in the postgrest repository (PostgREST/postgrest-docs#105) where it would have been most helpful for me.

@vmarchaud
Copy link
Contributor

@barbalex If you want our docs is hosted here, feel free to make a PR if you want to

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

7 participants