Hexo使用指南


安装pm2

npm install -g pm2

创建文件hexo_run.js

vi hexo_run.js
//run
const { exec } = require('child_process')
exec('hexo server',(error, stdout, stderr) => {
if(error){
console.log('exec error: ${error}')
return
}
console.log('stdout: ${stdout}');
console.log('stderr: ${stderr}');
})

后台运行

pm2 start hexo_run.js

其他脚本

pm2 start hexo_run.js -i max //启动 使用所有CPU核心的集群
pm2 stop hexo_run.js         // 停止
pm2 stop all            // 停止所有
pm2 restart hexo_run.js      // 重启
pm2 restart all         // 重启所有
pm2 delete  hexo_run.js      // 关闭

问题

如过没有全局化,做下面操作

cd /usr/local/nodejs/bin
ln -s /usr/local/nodejs/bin/pm2 /usr/bin/pm2

使用

hexo new your-title

文章作者: 运维网YUNWEI.WANG
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 运维网YUNWEI.WANG !
  目录