守护程序功能在 CentOS 6.4 中不起作用

Chr*_*tts 8 daemon centos centos6

我正在尝试在不同的用户下守护进程。

在我的 init.d 中,我有一个看起来像这样的服务:

...
start() {
    echo "Starting mydaemon..."
    daemon --user someuser --name mydaemon mycommand
}
...
Run Code Online (Sandbox Code Playgroud)

(整个脚本在这里:http : //pastebin.com/bvpnsHgn

但是,我得到的只是daemon: command not found.

我检查了daemon()在 中声明的内容/etc/init.d/functions,但是,我似乎无法使用它。

我该如何解决这个问题?

eww*_*ite 11

您是否确保在服务的 init.d 脚本中获取库的来源/etc/init.d/functions

您需要在 init.d 脚本中使用它:

# Source function library.
. /etc/init.d/functions
Run Code Online (Sandbox Code Playgroud)

如果这已经存在,您能否发布您的守护进程的启动脚本?