diff options
| author | Alon Levy <alon@pobox.com> | 2015-01-27 12:36:50 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-01-27 12:36:50 +0200 |
| commit | 1b3d9ebb4425dcee22ede0fd1be8c33c5d61e2b4 (patch) | |
| tree | b3c1da12db30df45be4a5ebaf1d1cb3c089346bb /tools | |
| parent | dff333b558cb29f1c6fa6d13ee4239a9bc0a81a6 (diff) | |
add reset-local-database.sh, extract tools/utils.sh
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/utils.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/utils.sh b/tools/utils.sh new file mode 100644 index 00000000..df5e2fb6 --- /dev/null +++ b/tools/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 +} |
