Skip to content

bug: repeated execution of make run will start multiple nginx processes, while make stop can only stop one #1690

@kevhoo

Description

@kevhoo

Issue description

重复执行 make run 会启动多个master进程,而 make stop 只能停止一个

Environment

  • apisix version (cmd: apisix version): 1.3
  • OS: centos7

Minimal test code / Steps to reproduce the issue

  1. cd apisix/
  2. make run
  3. make run
  4. ps aux | grep apisix | grep master

What's the actual result? (including assertion message & call stack if applicable)

系统启动了两个 openresty 实例

What's the expected result?

如果已有运行中的openresty实例,则不需要再启动新的实例

思路:判断/logs/nginx.pid 存在,表示服务已启动

Makefile line 82 ~ 84
        mkdir -p logs
        mkdir -p /tmp/apisix_cores/
        $(OR_EXEC) -p $$PWD/ -c $$PWD/conf/nginx.conf

修改为:

ifeq ("$(wildcard logs/nginx.pid)", "")
	mkdir -p logs
	mkdir -p /tmp/apisix_cores/
	$(OR_EXEC) -p $$PWD/ -c $$PWD/conf/nginx.conf
else
	@echo "Apisix is running..."
endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions