Anonymous (owner)

Revisions

  • c593af Mon Feb 02 03:06:32 -0800 2009
  • f88c10 Mon Feb 02 03:04:28 -0800 2009
  • 5fde87 Mon Feb 02 03:03:50 -0800 2009
gist: 56879 Download_button fork
public
Public Clone URL: git://gist.github.com/56879.git
Embed All Files: show embed
Bash #
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env bash
# loop.sh
 
TIME=${1-5}
 
while true; do
echo 'Running escript...'
    ./escript.erl
    echo "Timeout ($TIME s.)..."
    sleep $TIME
done
 
Erlang #
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env escript
% escript.erl
 
main(_) ->
    os:cmd("epmd -daemon"),
    io:format(" #1~n"),
 
    net_kernel:start([test_node, shortnames]), % <--- WARNING: This call causes the system freeze. But for this to heppen the escript.erl needs to be started a several times, so use loop.sh
    io:format(" #2~n"),
 
    erlang:set_cookie(node(), somecookie),
    io:format(" #3~n").