diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2018-01-03 07:39:50 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2018-01-03 07:39:50 +0200 |
commit | 19b65f376b0806fc24e928188f8a8bb03e6f58fd (patch) | |
tree | 1079bb2320db112ed72a6775209f0c7b4f8192c9 /installer | |
parent | b4c2b536d4a618ce85a4af5b50993dbb228325d9 (diff) |
added portable pidod
Diffstat (limited to 'installer')
-rw-r--r-- | installer/functions.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/installer/functions.sh b/installer/functions.sh index d403bfe520..765f1f134f 100644 --- a/installer/functions.sh +++ b/installer/functions.sh @@ -142,6 +142,24 @@ service() { } # ----------------------------------------------------------------------------- +# portable pidof + +pidof_cmd="$(which_cmd pidof)" +pidof() { + if [ ! -z "${pidof_cmd}" ] + then + ${pidof_cmd} "${@}" + return $? + else + ps -acxo pid,comm |\ + sed "s/^ *//g" |\ + grep netdata |\ + cut -d ' ' -f 1 + return $? + fi +} + +# ----------------------------------------------------------------------------- run_ok() { printf >&2 "${TPUT_BGGREEN}${TPUT_WHITE}${TPUT_BOLD} OK ${TPUT_RESET} ${*} \n\n" |