2014-09-19 02:49:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-02-15 06:05:08 +00:00
|
|
|
args=
|
|
|
|
|
2014-09-19 02:49:44 +00:00
|
|
|
if [ $(ls /conf|wc -l) = 0 ]; then
|
|
|
|
cp -r $TITAN_HOME/conf/* /conf
|
|
|
|
fi
|
|
|
|
|
2015-02-15 06:05:08 +00:00
|
|
|
rm -f /tmp/titan.properties
|
|
|
|
|
|
|
|
if [ -n "$CASS_PORT_9160_TCP_ADDR" ]; then
|
2015-02-16 14:50:03 +00:00
|
|
|
|
2015-02-15 06:05:08 +00:00
|
|
|
shortcut=/tmp/titan.properties
|
|
|
|
cat >> /tmp/titan.properties <<END
|
|
|
|
storage.backend=cassandra
|
|
|
|
storage.hostname=$CASS_PORT_9160_TCP_ADDR
|
|
|
|
END
|
2015-02-16 14:50:03 +00:00
|
|
|
|
|
|
|
elif [ -n "$CASS_ADDR" ]; then
|
|
|
|
|
|
|
|
shortcut=/tmp/titan.properties
|
|
|
|
cat >> /tmp/titan.properties <<END
|
|
|
|
storage.backend=cassandra
|
|
|
|
storage.hostname=$CASS_ADDR
|
|
|
|
END
|
|
|
|
|
2015-02-15 06:05:08 +00:00
|
|
|
fi
|
|
|
|
|
2015-02-16 14:50:03 +00:00
|
|
|
|
2015-05-20 01:41:17 +00:00
|
|
|
esAddr=${ES_ENV_PUBLISH_AS:-${ES_PORT_9300_TCP_ADDR}}
|
2015-02-16 14:50:03 +00:00
|
|
|
|
|
|
|
if [ -n "$ES_CLUSTER" -o -n "$esAddr" ]; then
|
2015-02-15 06:05:08 +00:00
|
|
|
shortcut=/tmp/titan.properties
|
|
|
|
cat >> /tmp/titan.properties <<END
|
|
|
|
index.search.backend=elasticsearch
|
|
|
|
index.search.elasticsearch.client-only=true
|
|
|
|
END
|
|
|
|
|
|
|
|
if [ -n "$ES_CLUSTER" ]; then
|
|
|
|
cat >> /tmp/titan.properties <<END
|
|
|
|
index.search.elasticsearch.ext.cluster.name=$ES_CLUSTER
|
|
|
|
END
|
|
|
|
fi
|
2015-02-16 14:50:03 +00:00
|
|
|
if [ -n "$esAddr" ]; then
|
|
|
|
# strip off the port spec, if present
|
|
|
|
esAddr=$(echo $esAddr | cut -d: -f1)
|
2015-02-15 06:05:08 +00:00
|
|
|
cat >> /tmp/titan.properties <<END
|
2015-02-16 14:50:03 +00:00
|
|
|
index.search.hostname=$esAddr
|
2015-02-15 06:05:08 +00:00
|
|
|
END
|
|
|
|
fi
|
2016-04-17 17:21:53 +00:00
|
|
|
|
2015-02-15 06:05:08 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$shortcut" ]; then
|
|
|
|
cat > /tmp/init.groovy <<END
|
|
|
|
g = TitanFactory.open('$shortcut')
|
|
|
|
println 'The graph \'g\' was opened using $shortcut'
|
|
|
|
END
|
|
|
|
args="$args /tmp/init.groovy"
|
|
|
|
fi
|
|
|
|
|
2016-04-17 17:21:53 +00:00
|
|
|
# Allow a little extra time for Cassandra to be ready
|
|
|
|
sleep 1
|
2015-02-15 06:05:08 +00:00
|
|
|
exec $TITAN_HOME/bin/gremlin.sh $args
|