Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bareos/bareos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlaa Eddine Elamri <alaeddine.elamri@bareos.com>2022-09-14 13:37:37 +0300
committerPhilipp Storz <philipp.storz@bareos.com>2022-09-19 13:46:50 +0300
commit556dc12cc2ed3142ee01a543f1cf7265ec40d67d (patch)
tree6df1dd7cb27fe2e3e2c1ebdad6f39bb73e88c2f5
parent027d8cdd396df8affb35597d941984656d8a7c93 (diff)
bareos-ctl-funcs: select first occurrence of the basename
-rwxr-xr-xcore/scripts/bareos-ctl-funcs4
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
}