diff options
author | Alaa Eddine Elamri <alaeddine.elamri@bareos.com> | 2022-09-14 13:37:37 +0300 |
---|---|---|
committer | Philipp Storz <philipp.storz@bareos.com> | 2022-09-19 13:46:50 +0300 |
commit | 556dc12cc2ed3142ee01a543f1cf7265ec40d67d (patch) | |
tree | 6df1dd7cb27fe2e3e2c1ebdad6f39bb73e88c2f5 | |
parent | 027d8cdd396df8affb35597d941984656d8a7c93 (diff) |
bareos-ctl-funcs: select first occurrence of the basename
-rwxr-xr-x | core/scripts/bareos-ctl-funcs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/scripts/bareos-ctl-funcs b/core/scripts/bareos-ctl-funcs index c6b0de878..8b7697af2 100755 --- a/core/scripts/bareos-ctl-funcs +++ b/core/scripts/bareos-ctl-funcs @@ -25,13 +25,13 @@ pidofproc() { if [ ! -z "${PGREP}" -a -x "${PGREP}" ] ; then pid=`${PGREP} -f $base` if [ "$pid" != "" ] ; then - echo $pid + echo $pid | cut -d' ' -f 1 return 0 fi fi # Finally try to extract it from ps - pid=`${PSCMD} | grep $base | ${AWK} '{ print $1 }' | tr '\n' ' '` + pid=`${PSCMD} | grep -m 1 $base | ${AWK} '{ print $1 }' | tr '\n' ' '` echo $pid return 0 } |