CentOS编译安装start-stop-daemon
问题描述
在CentOS 6.10系统中运行apollo,提示start-stop-daemon: warning: this system is not able to track process names
,百度发现,start-stop-daemon是debian的工具,在centos发布版中没有此工具,需要手动编译此工具。网上能找到的文章,基本都是apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz这个版本,但遗憾的是,按照其教程操作后,发现该版本不支持--no-close
项,apollo运行脚本仍然无法运行。
解决办法
1、下载dpkg_1.17.27.tar.xz
[root@vmware-zhy]#wget http://ftp.de.debian.org/debian/pool/main/d/dpkg/dpkg_1.17.27.tar.xz
2、解压并编译
[root@vmware-zhy]#tar -xf dpkg_1.17.27.tar.xz
[root@vmware-zhy]#cd dpkg-1.17.27
[root@vmware-zhy]#./configure
[root@vmware-zhy]#make
[root@vmware-zhy]#cd utils
[root@vmware-zhy]#cp start-stop-daemon /usr/local/bin/start-stop-daemon
说明:在make
过程中会报错,不过不需要管,直接进入utils目录,将该文件复制到/usr/local/bin/
目录即可。
3、查看
[root@vmware-zhy]#start-stop-daemon --help
Usage: start-stop-daemon [<option> ...] <command>
Commands:
-S|--start -- <argument> ... start a program and pass <arguments> to it
-K|--stop stop a program
-T|--status get the program status
-H|--help print help information
-V|--version print version
Matching options (at least one is required):
--pid <pid> pid to check
--ppid <ppid> parent pid to check
-p|--pidfile <pid-file> pid file to check
-x|--exec <executable> program to start/check if it is running
-n|--name <process-name> process name to check
-u|--user <username|uid> process owner to check
Options:
-g|--group <group|gid> run process as this group
-c|--chuid <name|uid[:group|gid]>
change to this user/group before starting
process
-s|--signal <signal> signal to send (default TERM)
-a|--startas <pathname> program to start (default is <executable>)
-r|--chroot <directory> chroot to <directory> before starting
-d|--chdir <directory> change to <directory> (default is /)
-N|--nicelevel <incr> add incr to the process' nice level
-P|--procsched <policy[:prio]>
use <policy> with <prio> for the kernel
process scheduler (default prio is 0)
-I|--iosched <class[:prio]> use <class> with <prio> to set the IO
scheduler (default prio is 4)
-k|--umask <mask> change the umask to <mask> before starting
-b|--background force the process to detach
-C|--no-close do not close any file descriptor
-m|--make-pidfile create the pidfile before starting
|--remove-pidfile delete the pidfile after stopping
-R|--retry <schedule> check whether processes die, and retry
-t|--test test mode, don't do anything
-o|--oknodo exit status 0 (not 1) if nothing done
-q|--quiet be more quiet
-v|--verbose be more verbose
Retry <schedule> is <item>|/<item>/... where <item> is one of
-<signal-num>|[-]<signal-name> send that signal
<timeout> wait that many seconds
forever repeat remainder forever
or <schedule> may be just <timeout>, meaning <signal>/<timeout>/KILL/<timeout>
The process scheduler <policy> can be one of:
other, fifo or rr
The IO scheduler <class> can be one of:
real-time, best-effort or idle
Exit status:
0 = done
1 = nothing done (=> 0 if --oknodo)
2 = with --retry, processes would not die
3 = trouble
Exit status with --status:
0 = program is running
1 = program is not running and the pid file exists
3 = program is not running
4 = unable to determine status