用pm2管理hexo进程

1、在博客根目录下加以下jsnpm

//run
const { exec } = require('child_process')
exec('hexo server -p 80 & ',(error, stdout, stderr) => {
        if(error){
                console.log('exec error: ${error}')
                return
        }
        console.log('stdout: ${stdout}');
        console.log('stderr: ${stderr}');
})

2、安装pm2 npm install -g pm2hexo

3、启动博客 pm2 start hexo_run.jsui

相关文章
相关标签/搜索