Commit 0f3ae9fb authored by Julien Muchembled's avatar Julien Muchembled

wrapper script: simplify pid checking

In commit 71d0c4fd, I had in mind to replace
  basename %s
by
  basename "$COMMAND"

Commit cfde18ad was a wrong fix.
parent 8f5fcf65
......@@ -155,16 +155,11 @@ class GenericBaseRecipe(object):
lines.append(dedent("""
# Check for other instances
pidfile=%s
if [ -e $pidfile ]; then
pid=$(cat $pidfile)
if [ ! -z "$(ps -p $pid | grep $(basename %s))" ]; then
echo "Already running with pid $pid."
exit 1
else
rm $pidfile
fi
if pid=`pgrep -F $pidfile -f "$COMMAND" 2>/dev/null`; then
echo "Already running with pid $pid."
exit 1
fi
echo $$ > $pidfile""" % (shlex.quote(pidfile), command)))
echo $$ > $pidfile""" % shlex.quote(pidfile)))
lines.append(dedent('''
# If the wrapped command uses a shebang, execute the referenced
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment