News for hackers. Stuff that matters.
Re:Parallelizing Jobs with xargs by IsaacSchlueter on Friday March 13, 2009 @01:16AM (#514538)
dtach is great for long-running jobs, too. If you pipe the output to a file, you can even log out and check back later.

I use this function to pass stuff off to a detached process:

    # usage:
    # headless "some_long_job" "long_job"
    # go get some tea, and come back
    # headless "" "long_job" (to join that session)
    # still not done, so ^\ to detach from it again
    # Usually, I pipe the output of some_long_job to
    # a file, so I can peek in on it easily
    headless () {
      if [ "$2" == "" ]; then
        hash=`md5 -qs "$1"`
      else
        hash="$2"
      fi
      if [ "$1" != "" ]; then
        dtach -n /tmp/headless-$hash bash -l -c "$1"
      else
        dtach -A /tmp/headless-$hash bash -l
      fi
    }

There are no comments on this comment yet.