summaryrefslogtreecommitdiff
path: root/src/local/utils.sh
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2015-04-21 13:54:52 +0300
committerLV-426 <lv-426@taproot.org.il>2015-04-21 13:54:52 +0300
commit31478c0f18c16e036a9ef8be0a1eb880bc94058e (patch)
tree9c5a2e32e3a9db08f4d6ec503c7fabcc285eb0a5 /src/local/utils.sh
parent8e14485a55ef0e4075735b7d190b29703f75b58f (diff)
refactoring tools/ contents to more appropriate places
Diffstat (limited to 'src/local/utils.sh')
-rw-r--r--src/local/utils.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/local/utils.sh b/src/local/utils.sh
new file mode 100644
index 00000000..df5e2fb6
--- /dev/null
+++ b/src/local/utils.sh
@@ -0,0 +1,27 @@
+# utilities to be sourced for rhizi bash scripts
+
+if [ "x$NEO4J_ROOT" == "x" ]; then
+ NEO4J_SHELL=`which neo4j-shell`
+ if [ "x$NEO4J_SHELL" == "x" ]; then
+ echo missing neo4j-shell, please define NEO4J_ROOT or place neo4j-shell in PATH
+ exit 1
+ fi
+else
+ NEO4J_SHELL="$NEO4J_ROOT/bin/neo4j-shell"
+ if [ ! -e $NEO4J_SHELL ]; then
+ echo "\$NEO4J_ROOT/bin/neo4j-shell does not exist, fix NEO4J_ROOT"
+ exit 1
+ fi
+fi
+
+function quit_if_no_neo4j_running () {
+ if [ `uname` == "Darwin" ]; then
+ neo4j_count=`netstat -na -ptcp 2>/dev/null | grep 7474 | wc -l`
+ else
+ neo4j_count=`netstat -ltnop 2>/dev/null | grep 7474 | wc -l`
+ fi
+ if [ $neo4j_count == "0" ]; then
+ echo run neo4j please
+ exit 0
+ fi
+}