Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

[issue 1066]: enhance service script to return version information for '-v' option #1230

Merged
merged 3 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 3 additions & 2 deletions scripts/nebula.service
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ function kill_daemon {
# args: <daemon name> [config file]
function status_daemon {
local daemon_name=nebula-${1}
local daemon_version=$(daemon_version ${INSTALL_ROOT}/bin/${daemon_name})
local config=${2}

[[ -z ${config} ]] && config=${INSTALL_ROOT}/etc/${daemon_name}.conf
Expand All @@ -224,9 +225,9 @@ function status_daemon {
else
port=${BLINK}${RED}${port}${NC}
fi
INFO "${daemon_name}: Running as $(cat ${pid_file}), Listening on ${port}"
INFO "${daemon_name}(${daemon_version}): Running as $(cat ${pid_file}), Listening on ${port}"
else
INFO "${daemon_name}: Exited"
INFO "${daemon_name}(${daemon_version}): Exited"
fi
}

Expand Down
7 changes: 7 additions & 0 deletions scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,10 @@ function env_check {
WARN "The CPU time a process can consume is restricted to ${cputime}"
fi
}

# Get the daemon Git commit version information
function daemon_version {
local version=$(${1} --version | head -n 1)
echo ${version} | sed 's/.*Git: \([[:alnum:]]*\).*/\1/g'
}