2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 13:37:55 +00:00

[4224] Removed get_pids function and updated get_pid documentation.

This commit is contained in:
Marcin Siodelski
2015-12-15 20:42:36 +01:00
parent b9f7b33e0e
commit 52bb079ae6

View File

@@ -177,11 +177,18 @@ if [ ! -z ${KEA_PIDFILE_DIR} ]; then
PID_FILE_PATH="${KEA_PIDFILE_DIR}" PID_FILE_PATH="${KEA_PIDFILE_DIR}"
fi fi
# Returns 1 if specified Kea process is running, 0 otherwise # Checks if specified process is running.
# This function uses PID file to make this determination. #
# Return values: # This function uses PID file to obtain the PID and then calls
# 'kill -0 <pid>' to check if the process is alive.
# The PID files are expected to be located in the ${PID_FILE_PATH},
# and their names are should follow the follwing pattern:
# <cfg_file_name>.<proc_name>.pid. If the <cfg_file_name> is not
# specified a 'test_config' is used by default.
#
# Return value:
# _GET_PID: holds a PID if process is running # _GET_PID: holds a PID if process is running
# _GET_PIDS_NUM: 1 if process running, 0 otherwise # _GET_PIDS_NUM: holds 1 if process is running, 0 otherwise
get_pid() { get_pid() {
local proc_name=${1} # Process name local proc_name=${1} # Process name
local cfg_file_name=${2} # Configuration file name without extension. local cfg_file_name=${2} # Configuration file name without extension.
@@ -216,21 +223,6 @@ get_pid() {
fi fi
} }
# Returns the number of running process pids and the list of pids.
# Return values:
# _GET_PIDS: holds space separated list of pids.
# _GET_PIDS_NUM: holds the number pids.
get_pids() {
local proc_name=${1} # Process name
if [ -z ${proc_name} ]; then
test_lib_error "get_pids requires process name"
clean_exit 1
fi
_GET_PIDS=$( ps axwwo pid,command | grep ${proc_name} \
| grep -v grep | awk '{print $1}' )
_GET_PIDS_NUM=$( printf "%s" "${_GET_PIDS}" | wc -w | awk '{print $1}' )
}
# Returns the number of occurrences of the Kea log message in the log file. # Returns the number of occurrences of the Kea log message in the log file.
# Return value: # Return value:
# _GET_LOG_MESSAGES: number of log message occurrences. # _GET_LOG_MESSAGES: number of log message occurrences.