I've used pm2 in the past for my express apps. I really like it. How do I get it to run hexo
. Hexo starts with hexo server
rather than with a js entry point.
Asked
Active
Viewed 1,025 times
6

Evan Carroll
- 78,363
- 46
- 261
- 468
2 Answers
4
If you're running Linux or OSX, you can start it with a bash script.
Create a file called hexo.sh with the following
#!/usr/bin/env bash
hexo server
Then just simply
pm2 start hexo.sh

Ben Fortune
- 31,623
- 10
- 79
- 80
-
@AbnerChou Well it won't, it's a bash script. – Ben Fortune May 08 '17 at 19:13
-
I have turned it to the batch script. The pm2 task fails. – Josan May 08 '17 at 19:15
-
@AbnerChou For me, I need to add `cd "$(dirname "$0")"` before `hexo server` to make it work. – Harry Summer May 10 '17 at 15:53
0
I think you can try with:
pm2 start app.js -- server -s
Where app.js is a simple file containing this:
require('hexo-cli');

michelem
- 14,430
- 5
- 50
- 66