Skip to content

Commit

Permalink
Add start file that lives on the AMI.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkraljevic committed Sep 23, 2013
1 parent b25615d commit 2a47733
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ec2/ami/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Files in this directory live in the ec2-user directory of the AMI, and
may be called from scripts in the parent directory.
23 changes: 23 additions & 0 deletions ec2/ami/start-h2o-bg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

d=`dirname $0`

# Use 90% of RAM for H2O.
memTotalKb=`cat /proc/meminfo | grep MemTotal | sed 's/MemTotal:[ \t]*//' | sed 's/ kB//'`
memTotalMb=$[ $memTotalKb / 1024 ]
tmp=$[ $memTotalMb * 90 ]
xmxMb=$[ $tmp / 100 ]

# First try running java.
export JAVA_HOME=${d}/jdk1.7.0_40
echo JAVA_HOME is ${JAVA_HOME}
${JAVA_HOME}/bin/java -version

# Check that we can at least run H2O with the given java.
${JAVA_HOME}/bin/java -jar h2o.jar -version

# Start H2O disowned in the background.
nohup ${JAVA_HOME}/bin/java -Xmx${xmxMb}m -jar h2o.jar -name H2ODemo -flatfile flatfile.txt -port 54321 -beta -ice_root ${d}/ice_root 1> h2o.out 2> h2o.err &

0 comments on commit 2a47733

Please sign in to comment.