Skip to content

Commit

Permalink
[#49] Do not create a login shell in elasticsearch.init script
Browse files Browse the repository at this point in the history
Do not use the '-' flag to `su` since it creates a login shell. Doing that
will prevent the environment from being inherited unless you also use '-m'.

Using '-' and '-m' when running bash will cause the launched shell to
try to read $HOME/.bash_profile, since $HOME still refers to the home
directory of root and the elasticsearch user does not have read access there.

A simple solution is to omit '-' and '-m'. The program will still run under
the `elasticsearch` user but will inherit environment variables and will not
print an error message.

Closes #49
  • Loading branch information
maf23 authored and karmi committed Jan 27, 2013
1 parent c6f302f commit f875a35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion templates/default/elasticsearch.init.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ start() {
fi

echo -e "\033[1mStarting elasticsearch...\033[0m"
su - <%= node[:elasticsearch][:user] %> -m -c "ES_INCLUDE=$ES_INCLUDE /usr/local/bin/elasticsearch -p $PIDFILE"
su <%= node[:elasticsearch][:user] %> -c "ES_INCLUDE=$ES_INCLUDE /usr/local/bin/elasticsearch -p $PIDFILE"

return $?
}
Expand Down

0 comments on commit f875a35

Please sign in to comment.