守护进程的init.d脚本 - 无法删除pidfile

时间:2015-06-30 23:34:14

标签: bash ubuntu init.d

在ubuntu(14.04)上停止守护进程时删除pid文件时出现问题。

我用以下命令启动守护进程:

log_daemon_msg "Starting $DAEMON_NAME"
start-stop-daemon --start --background --pidfile $PIDFILE --make-pid --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON
log_end_msg $?

注意使用--make-pid我需要或没有创建pidfile。我要停止:

log_daemon_msg "Stopping $DAEMON_NAME"
start-stop-daemon --stop --pidfile $PIDFILE --retry 10
log_end_msg $?
rm $PIDFILE

我想使用标志--remove-pidfile而不是rm(因为我试图使其成为通用的(交叉发行版)),但它会导致错误。

检查手册页(http://manpages.ubuntu.com/manpages/karmic/man8/start-stop-daemon.8.html),ubuntu似乎没有--remove-flag,尽管其他发行版提到了它。

有没有人知道会做这个的任何标志,还是我应该坚持使用rm?

1 个答案:

答案 0 :(得分:1)

如果ubutu上的h版本没有那个标志,那么我认为你发现的是(为了制作这个通用的)你应该避免它并坚持自己做。 - Etan Reisner

相关问题