summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xreset-local-database.sh7
-rwxr-xr-xrun-local.sh13
-rw-r--r--tools/utils.sh27
3 files changed, 38 insertions, 9 deletions
diff --git a/reset-local-database.sh b/reset-local-database.sh
new file mode 100755
index 00000000..ad53f8b7
--- /dev/null
+++ b/reset-local-database.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+. tools/utils.sh
+
+quit_if_no_neo4j_running
+
+$NEO4J_SHELL -file res/neo4j/reset-db__single_link.cypher
diff --git a/run-local.sh b/run-local.sh
index 39c1580b..6cbb3568 100755
--- a/run-local.sh
+++ b/run-local.sh
@@ -1,13 +1,8 @@
#!/bin/sh
-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
+. tools/utils.sh
+
+quit_if_no_neo4j_running
+
CONFIG=res/etc/rhizi-server.conf
EXAMPLE=res/etc/rhizi-server.conf.example
HTPASSWD=res/etc/htpasswd
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
+}