Public bug reported:

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.

** Affects: run-one (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1190017

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/run-one/+bug/1190017/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to