【systemctl】让程序以守护进程的方式在后台运行

首先需要创建一个systemd unit 配置文件,比如:verdaccio.service,一般放在 /lib/systemd/system/ 下

添加配置如下:

[Unit]
Description=Verdaccio lightweight npm proxy registry

[Service]
Type=simple
Restart=on-failure
User=verdaccio
ExecStart=/usr/bin/verdaccio --config /etc/verdaccio/config.yaml

[Install]
WantedBy=multi-user.target

开机自启动:

systemctl enable verdaccio.service

立即启动:

systemctl start verdaccio.service

重新启动:

systemctl restart verdaccio.service

运行状态:

systemctl status verdaccio.service

上一篇:[USACO20FEB]Help Yourself G


下一篇:What can I hold you with