How do I configure pm2 to run hexo?
Asked Answered
E

2

6

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.

Extraterritoriality answered 11/12, 2015 at 8:15 Comment(0)
L
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
Lamson answered 11/12, 2015 at 9:21 Comment(3)
@AbnerChou Well it won't, it's a bash script.Lamson
I have turned it to the batch script. The pm2 task fails.Godavari
@AbnerChou For me, I need to add cd "$(dirname "$0")" before hexo server to make it work.Cellobiose
N
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');
Nonparticipating answered 11/12, 2015 at 8:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.