Skip to content

Commit

Permalink
fixed problem with macos to get owner of neo4j binary
Browse files Browse the repository at this point in the history
  • Loading branch information
ogmueller committed Jul 29, 2018
1 parent 2eb40fc commit 680df94
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ineo
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ LOCK_DIR='/tmp/ineo.neo4j.instances.lock'
TEMP_DIR="/tmp/$$.ineo"

SED_CMD="sed -i "
OWNER_CMD="stat -c '%U'"

# Regular Colors
BLACK='\033[0;30m'
Expand Down Expand Up @@ -749,13 +750,13 @@ function autostart {
fi

# find out whose instance we are going to start
local owner=$(stat -c '%U' "${INEO_HOME}/instances/${instance_name}/bin/neo4j")
local owner=$(${OWNER_CMD} "${INEO_HOME}/instances/${instance_name}/bin/neo4j")

printf "\n start '${instance_name}'\n "

# because we are in autostart, we want to start the instances as if their owner would have started them,
# so they are able to stop and administrate them themselves
sudo -n -u "${owner}" -- "${INEO_HOME}/instances/${instance_name}/bin/neo4j" "start"
sudo -n -u ${owner} -- "${INEO_HOME}/instances/${instance_name}/bin/neo4j" "start"

# don't delay if this instance is the last to be autostarted
if [[ "${instance_name}" != "${last}" ]]; then
Expand Down Expand Up @@ -1623,6 +1624,7 @@ COMMAND=$1
if [[ "$( uname )" == "Darwin" ]]; then
# sed command is just incompatible with -i option
SED_CMD="sed -i ''"
OWNER_CMD="stat -f %Su"
fi

set_instances
Expand Down

0 comments on commit 680df94

Please sign in to comment.