Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): wrap nginx quit cmd #4360

Merged
merged 1 commit into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion apisix/cli/ops.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ init: initialize the local nginx.conf
init_etcd: initialize the data of etcd
start: start the apisix server
stop: stop the apisix server
quit: stop the apisix server gracefully
restart: restart the apisix server
reload: reload the apisix server
version: print the version of apisix
Expand Down Expand Up @@ -679,7 +680,7 @@ local function start(env, ...)
end


local function stop(env)
local function cleanup()
local local_conf_path = profile:yaml_path("config")
local bak_exist = io_open(local_conf_path .. ".bak")
if bak_exist then
Expand All @@ -692,6 +693,20 @@ local function stop(env)
util.die("failed to mv original config file, error: ", err)
end
end
end


local function quit(env)
cleanup()

local cmd = env.openresty_args .. [[ -s quit]]
util.execute_cmd(cmd)
end


local function stop(env)
cleanup()

local cmd = env.openresty_args .. [[ -s stop]]
util.execute_cmd(cmd)
end
Expand Down Expand Up @@ -730,6 +745,7 @@ local action = {
init_etcd = etcd.init,
start = start,
stop = stop,
quit = quit,
restart = restart,
reload = reload,
}
Expand Down
4 changes: 4 additions & 0 deletions ci/linux_apisix_master_luarocks_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ script() {
sudo PATH=$PATH apisix help
sudo PATH=$PATH apisix init
sudo PATH=$PATH apisix start
sudo PATH=$PATH apisix quit
sudo PATH=$PATH apisix start
sudo PATH=$PATH apisix stop

sudo PATH=$PATH ./utils/install-apisix.sh remove > build.log 2>&1 || (cat build.log && exit 1)
Expand All @@ -62,6 +64,8 @@ script() {
sudo PATH=$PATH apisix help
sudo PATH=$PATH apisix init
sudo PATH=$PATH apisix start
sudo PATH=$PATH apisix quit
sudo PATH=$PATH apisix start
sudo PATH=$PATH apisix stop

# apisix cli test
Expand Down