Hexo: How can I stop hexo server besides Ctrl-C?

Created on 2 Mar 2016  ·  3Comments  ·  Source: hexojs/hexo

I want to write a script of systemd for hexo to start it when system starts, but I don't know how to stop hexo server using commonds besides Ctrl-C.

Most helpful comment

我去……兄弟原来是天朝的啊……查英语把我累的 _(:з」∠❀)_

All 3 comments

  1. Create you service file for systemd

Here is an exmaple

[Unit]
Description=Hexo Server

[Service]
Type=simple
ExecStart=/bin/hexo server
ExecStop=/bin/kill -TERM $MAINPID
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
WorkingDirectory=/path/to/your/website

[Install]
WantedBy=multi-user.target
WantedBy=graphical.target
  1. Autostart setup
$ sudo systemctl daemon-reload
$ sudo systemctl enable hexo.service
  1. Start & Stop
$ sudo systemctl start hexo.service
$ sudo systemctl status hexo.service
$ sudo systemctl stop hexo.service
$ sudo systemctl status hexo.service

我去……兄弟原来是天朝的啊……查英语把我累的 _(:з」∠❀)_

Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings