当我重新启动我的 Ubuntu 服务器时,如何让 sphinx 重新启动?

12 linux ubuntu sphinxsearch

我在 ubuntu 9.04 服务器上构建并安装了 sphinx 搜索。

重新启动时如何使 sphinx 守护程序自动启动?

Iva*_*van 13

我不知道 Sphinx,但这是基本方法。创建一个包含以下内容的文件/etc/init.d/searchd(还有这个脚本,但你可能需要稍微调整一下):

#!/bin/bash

case "${1:-''}" in
  'start')
        # put the command to start sphinx
        # i.e., /usr/bin/searchd start or /usr/bin/searchd --daemon or whatever the command is
        ;;
  'stop')
        # stop command here
        ;;
  'restart')
        # restart command here
        ;;
  *)
        echo "Usage: $SELF start|stop|restart"
        exit 1
        ;;
esac
Run Code Online (Sandbox Code Playgroud)

然后执行以下操作:

$ sudo update-rc.d searchd defaults
Run Code Online (Sandbox Code Playgroud)

手动控制服务:

$ sudo /etc/init.d/searchd <start|stop|restart>
Run Code Online (Sandbox Code Playgroud)


小智 0

将重启脚本添加到 /etc/init.d 目录。