Last active
August 29, 2015 14:00
-
-
Save wallyqs/11141778 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#+TITLE: Running scripts in parallel | |
In the following example, the following 3 scripts should be run in parallel | |
with all output being flushed to the screen. | |
- Count some numbers with bash | |
#+name: bash_counter | |
#+begin_src sh :shebang #!/bin/bash | |
echo '' > out.log | |
for i in `seq 1 5`; do | |
echo "Writing! $i" | |
echo "hello $i" >> out.log | |
sleep $(($RANDOM % 5)) | |
done | |
#+end_src | |
- Count some numbers with ruby | |
#+name: ruby_counter | |
#+begin_src ruby :shebang #!/usr/bin/ruby | |
$stdout.sync = true | |
sleep 0.2 | |
10.times do |n| | |
puts "And now writing! #{n}" | |
File.open("out.log", "a") {|f| f.puts "Hello again #{n}" } | |
sleep rand.round(2) | |
end | |
#+end_src | |
- Print some numbers with python | |
#+name: python_counter | |
#+begin_src python :shebang #!/usr/bin/python | |
for i in range(0,3): | |
print i | |
#+end_src | |
- Block that should not be run | |
#+begin_src js | |
{ | |
"hello": "world" | |
} | |
#+end_src |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment