Jim*_*mmy 1 debian boot systemd
我尝试使用以下方法将 NiFi 作为启动服务运行:
sudo systemctl enable nifi.service
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
nifi.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nifi
update-rc.d: error: nifi Default-Start contains no runlevels, aborting.
Run Code Online (Sandbox Code Playgroud)
本教程建议对 shell 文件进行更改,但我不使用这样的文件。任何帮助,将不胜感激。
小智 6
尝试为 nifi 创建 systemd 文件,下面是示例,请相应地更改路径/用户/组。
$ sudo vi /etc/systemd/system/nifi.service
[Unit]
Description=Apache NiFi
After=network.target
[Service]
Type=forking
User=nifi
Group=nifi
ExecStart=/opt/nifi-latest/bin/nifi.sh start
ExecStop=/opt/nifi-latest/bin/nifi.sh stop
ExecRestart=/opt/nifi-latest/bin/nifi.sh restart
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
之后,您可以像下面一样使用 systemctl
$ sudo systemctl daemon-reload
$ sudo systemctl 启动 nifi.service
$ sudo systemctl status nifi.service
$ sudo systemctl 启用 nifi.service