})
运行开启命令: pm2 start hexo_run.js
最后附上 zhouwaiqiang 写的一个hexo重启脚本restart_hexo.sh(需要先配置好nginx),需要重启刷新的时候执行source restart_hexo.sh即可:
➜ blemesh cat restart_hexo.sh
#!/bin/bash
PROCESS=`ps -ef|grep hexo|grep -v grep|grep -v PPID|awk '{ print $2 }'`
PROC_NAME="pm2"
for i in $PROCESS
do
echo "Kill the $1 process [ $i ]"
kill -9 $i
done
hexo clean #清除数据
hexo generate #生成静态文件public文件夹
ProcNumber=`ps -ef |grep -w $PROC_NAME|grep -v grep|wc -l`
if [ $ProcNumber -le 0 ];then
pm2 start hexo_run.js
else
pm2 restart hexo_run.js
fi
service nginx restart七、体验
启动:sh ./restart_hexo.sh
访问主页: http://www.beautifulzzzz.com:8001/
访问nginx静态快速版网页: http://www.beautifulzzzz.com:3001/
访问后台编写文章: http://www.beautifulzzzz.com:8001/admin/
编写好之后点击Deploy会自动调用之前的脚本,静态网页就有了

完









