run-this-one does not match shell scripts (using pgrep)

Bug #1190017 reported by Daniel Hahler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
run-one (Ubuntu)
Fix Released
Medium
Dustin Kirkland 

Bug Description

I have the following shell script, which does not work properly with `run-this-one`:

    #!/usr/bin/zsh -i
    #
    # Execute a given command on the first reachable host
    #
    # Syntax: on_first_host 'cmd %s' hostA hostB

    on_first_host() {
      cmd=$1
      shift
      for host; do
        echo "Trying $host..."
        ping -c1 -w2 -q $host > /dev/null || continue
        $(printf $cmd $host)
        return
      done
    }
    on_first_host "$@"

When called like this, the first pgrep in the "run-this-one" case will not find the running process:

    run-this-one on_first_host 'foo %s' foobar boobaz

The second try, using lsof appears to find the matching progress, but when using "ssh" as a command for "on_first_host", the "sleep 0.1" appears to be too short (the ssh process is still running), and the following "flock" command fails.

Related branches

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Committed revision 37.

Changed in run-one (Ubuntu):
assignee: nobody → Dustin Kirkland (kirkland)
importance: Undecided → Medium
status: New → In Progress
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package run-one - 1.10-0ubuntu1

---------------
run-one (1.10-0ubuntu1) saucy; urgency=low

  * No changes
  * Re-release, due to minor errors in release script
 -- Dustin Kirkland <email address hidden> Tue, 16 Jul 2013 14:55:49 -0500

Changed in run-one (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.