summaryrefslogtreecommitdiff
path: root/src/local/utils.sh
blob: 0738498bce42cc90d5fd1fcaffa2401e7feaa84e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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 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
    [ $neo4j_count -gt "0" ]
}

function quit_if_no_neo4j_running () {
    if neo4j_running ; then
        return 0
    else
        echo neo4j not running
        exit 0
    fi
}