[Dev] Replace --stop option with --once

This commit is contained in:
samuel 2023-04-25 15:11:29 +02:00
parent 30d6b61e52
commit 77ca0cfc56
4 changed files with 16 additions and 16 deletions

View File

@ -87,8 +87,8 @@ Mandatory argumentes for long options are mandatory for short options too.
-d, --daemon run processing loop in background
-e, --errs=<errors_file> name of errors file, default to
${DEFAULT_ERRORS_FILE}
-o, --once stop listening after first request process
-q, --quiet set level verbosity to WARN, default to INFO
-s, --stop stop listening after first request process
-t, --test just test config file and do not run start loop
-v, --verbose set level verbosity to DEBUG, default to INFO
@ -260,8 +260,8 @@ main() (
verbosity_option=""
verbosity_level="${DEFAULT_VERBOSITY_LEVEL}"
if ! args="$(getopt --name "${PROGRAM_NAME}" \
--options c:de:hqstv \
--longoptions conf:,daemon,errs:,help,quiet,stop,test,verbose \
--options c:de:hoqtv \
--longoptions conf:,daemon,errs:,help,once,quiet,test,verbose \
-- "$@")"; then
usage
fail "Bad arguments."
@ -286,6 +286,10 @@ main() (
usage
exit 0
;;
-o | --once)
keep_open="false"
shift
;;
-q | --quiet)
if [ "${verbosity_option}" ]; then
usage
@ -295,10 +299,6 @@ main() (
((verbosity_level -= 10))
shift
;;
-s | --stop)
keep_open="false"
shift
;;
-t | --test)
testing="true"
shift

View File

@ -81,8 +81,8 @@ Mandatory argumentes for long options are mandatory for short options too.
-d, --daemon run processing loop in background
-e, --errs=<errors_file> name of errors file, default to
${DEFAULT_ERRORS_FILE}
-o, --once stop listening after first request process
-q, --quiet set level verbosity to WARN, default to INFO
-s, --stop stop listening after first request process
-t, --test just test config file and do not run start loop
-v, --verbose set level verbosity to DEBUG, default to INFO
@ -317,8 +317,8 @@ main() (
verbosity_option=""
verbosity_level="${DEFAULT_VERBOSITY_LEVEL}"
if ! args="$(getopt --name "${PROGRAM_NAME}" \
--options c:de:hqstv \
--longoptions conf:,daemon,errs:,help,quiet,stop,test,verbose \
--options c:de:hoqtv \
--longoptions conf:,daemon,errs:,help,once,quiet,test,verbose \
-- "$@")"; then
usage
fail "Bad arguments."
@ -343,6 +343,10 @@ main() (
usage
exit 0
;;
-o | --once)
keep_open="false"
shift
;;
-q | --quiet)
if [ "${verbosity_option}" ]; then
usage
@ -352,10 +356,6 @@ main() (
((verbosity_level -= 10))
shift
;;
-s | --stop)
keep_open="false"
shift
;;
-t | --test)
testing="true"
shift

View File

@ -43,7 +43,7 @@ send_request() (
request="$1"
"${deployer_bin}" --conf="${conf_file}" --errs="${errs_file}" \
--daemon --stop --verbose || return $?
--daemon --once --verbose || return $?
(
inotifywait --event create --quiet --quiet "${response_sock_dir}"
echo "${request}" | ncat --unixsock "${deployer_sock}"

View File

@ -46,7 +46,7 @@ send_request() (
ncat --listen --unixsock "${deployer_sock}" &
"${runner_bin}" --conf="${conf_file}" --errs="${errs_file}" \
--daemon --stop --verbose
--daemon --once --verbose
code=$?
if [ "${code}" -ne 0 ]; then
echo "fail" | ncat --unixsock "${deployer_sock}"