From 51ec022933b514252f55a5ae3430d9d150b8c8a3 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Thu, 17 May 2018 16:34:38 +0200 Subject: [PATCH] Make silent an option Signed-off-by: Patrick Uiterwijk --- roles/base/files/common-scripts/lock-wrapper | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/roles/base/files/common-scripts/lock-wrapper b/roles/base/files/common-scripts/lock-wrapper index 955be7ff10..f0535778bc 100755 --- a/roles/base/files/common-scripts/lock-wrapper +++ b/roles/base/files/common-scripts/lock-wrapper @@ -8,6 +8,11 @@ fi NAME=$1 SCRIPT=$2 +SILENT="no" +if [ $# -ge 3 -a "$3" == "--silent" ]; then + SILENT="yes" +fi + LOCKDIR="/var/tmp/$NAME" PIDFILE="$LOCKDIR/pid" @@ -22,6 +27,10 @@ if ! mkdir "$LOCKDIR"; then PID=$(cat "$PIDFILE") if [ -n "$PID" ] && /bin/ps $PID > /dev/null then + if [ "$SILENT" != "yes" ]; then + echo "$PID is still running" + /bin/ps -o user,pid,start,time,comm $PID + fi exit 1; else echo "$LOCKDIR exists but $PID is dead"