You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sh...@apache.org on 2021/06/02 17:55:27 UTC

[apisix] branch master updated: feat(cli): wrap nginx quit cmd (#4360)

This is an automated email from the ASF dual-hosted git repository.

shuyangw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 0637d79  feat(cli): wrap nginx quit cmd (#4360)
0637d79 is described below

commit 0637d7973bd13ab897eb13f39fcc18baa7e86fcf
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Thu Jun 3 01:55:18 2021 +0800

    feat(cli): wrap nginx quit cmd (#4360)
    
    Signed-off-by: spacewander <sp...@gmail.com>
---
 apisix/cli/ops.lua                        | 18 +++++++++++++++++-
 ci/linux_apisix_master_luarocks_runner.sh |  4 ++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index bf31eb6..83229b4 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -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
@@ -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
@@ -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
@@ -730,6 +745,7 @@ local action = {
     init_etcd = etcd.init,
     start = start,
     stop = stop,
+    quit = quit,
     restart = restart,
     reload = reload,
 }
diff --git a/ci/linux_apisix_master_luarocks_runner.sh b/ci/linux_apisix_master_luarocks_runner.sh
index c889ed2..337b4c4 100755
--- a/ci/linux_apisix_master_luarocks_runner.sh
+++ b/ci/linux_apisix_master_luarocks_runner.sh
@@ -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)
@@ -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