Ubuntu 中的状态、killproc 命令

5 ubuntu init.d

我正在尝试将init.d脚本从 centos 6.6 服务器迁移到 ubuntu 14.04。Centos机器start, status, stop命令是,

daemon --pidfile=/path/to/pidfile /path/to/daemon/script
status -p /path/to/pidfile /path/to/daemon/script
killproc -p /path/to/pidfile /path/to/daemon/script
Run Code Online (Sandbox Code Playgroud)

start命令在 ubuntu 14.04 上以其原始形式运行良好,但其他两个函数status, killproc在 ubuntu 发行版上没有定义。

这些命令在 ubuntu 机器中的等价物是什么?

Mik*_*kel 5

在我的 Ubuntu 系统上,killproc/lib/lsb/init-functions.

http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html

你有没有尝试过把

. /lib/lsb/init-functions
Run Code Online (Sandbox Code Playgroud)

靠近你的初始化脚本的顶部?

$ dpkg -S /lib/lsb/init-functions
lsb-base: /lib/lsb/init-functions

$ dpkg -S /sbin/status
upstart: /sbin/status

$ apt-cache show lsb-base
Package: lsb-base
Priority: required
Run Code Online (Sandbox Code Playgroud)