From 7e7c4eff8f56f9e19919daa6e4db7fb46385e7fa Mon Sep 17 00:00:00 2001 From: Akash Askoolum Date: Fri, 27 Mar 2020 08:17:09 +0000 Subject: [PATCH] refine command names `locate-nginx` and `restart-nginx` is a bit verbose; `locate` and `restart` provides a better API. Creates symlinks for backwards compatibility as this will be a minor release. --- script/locate | 5 +++++ script/locate-nginx | 6 +----- script/restart | 14 ++++++++++++++ script/restart-nginx | 15 +-------------- 4 files changed, 21 insertions(+), 19 deletions(-) create mode 100755 script/locate mode change 100755 => 120000 script/locate-nginx create mode 100755 script/restart mode change 100755 => 120000 script/restart-nginx diff --git a/script/locate b/script/locate new file mode 100755 index 0000000..a6d81b1 --- /dev/null +++ b/script/locate @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*conf-path=\([^ ]*\)\/nginx\.conf.*/\1/g' diff --git a/script/locate-nginx b/script/locate-nginx deleted file mode 100755 index a6d81b1..0000000 --- a/script/locate-nginx +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -e - -nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*conf-path=\([^ ]*\)\/nginx\.conf.*/\1/g' diff --git a/script/locate-nginx b/script/locate-nginx new file mode 120000 index 0000000..3fcf8a5 --- /dev/null +++ b/script/locate-nginx @@ -0,0 +1 @@ +locate \ No newline at end of file diff --git a/script/restart b/script/restart new file mode 100755 index 0000000..f7c709d --- /dev/null +++ b/script/restart @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -e + +# colours +YELLOW='\033[1;33m' +NC='\033[0m' # no colour - reset console colour + +echo -e "${YELLOW}Restarting nginx. This requires sudo access.${NC}" + +if pgrep 'nginx' > /dev/null; then + sudo nginx -s stop +fi +sudo nginx diff --git a/script/restart-nginx b/script/restart-nginx deleted file mode 100755 index f7c709d..0000000 --- a/script/restart-nginx +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# colours -YELLOW='\033[1;33m' -NC='\033[0m' # no colour - reset console colour - -echo -e "${YELLOW}Restarting nginx. This requires sudo access.${NC}" - -if pgrep 'nginx' > /dev/null; then - sudo nginx -s stop -fi -sudo nginx diff --git a/script/restart-nginx b/script/restart-nginx new file mode 120000 index 0000000..b7dc720 --- /dev/null +++ b/script/restart-nginx @@ -0,0 +1 @@ +restart \ No newline at end of file