我在 ubuntu 16 上安装了 influxdb,出于某种原因,当我尝试在终端中写入时,service influxd
它给了我influxd: unrecognized service.
如果我只输入 influxd,则 influxdb 服务器正在启动,因此命令 influxd 已启动
$ which influxd :
$ /usr/bin/influxd
我尝试做的是让它像服务一样运行,这样我就可以按需启动和停止它,并让它在启动时自动启动
尝试建立到文件夹 /etc/init.d 的符号链接,但是也不起作用。
答案1
您可以通过添加调用来解决这个问题,/etc/rc.local
这样文件内容之后看起来就会像这样:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
Examples (use only one, you might need to try which one will work):
# option 1. direct call
/usr/bin/influxd
# option 2. call it from init.d but I'm not sure this will work in your case
/etc/init.d/influxd start
exit 0
使用 Ubuntu 16.04 LTS,你可以像评论中指出的那样,看看systemd
服务。我无法像在链接的文档表中那样更好地解释它,所以我只将其保留为链接。