Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
upstart job for elastic search
# ElasticSearch Service
description "ElasticSearch"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
respawn limit 10 5
env ES_HOME=/usr/share/elasticsearch/home
env ES_MIN_MEM=256m
env ES_MAX_MEM=2g
env DAEMON="${ES_HOME}/bin/elasticsearch"
env DATA_DIR=/data/elasticsearch/data
env CONFIG_DIR=/etc/elasticsearch
console output
script
if [ -f /etc/default/elasticsearch ]; then
. /etc/default/elasticsearch
fi
su -s /bin/dash -c "/usr/bin/elasticsearch -f -Des.path.conf=$CONFIG_DIR -Des.path.home=$ES_HOME -Des.path.logs=$LOG_DIR -Des.path.data=$DATA_DIR -Des.path.work=$WORK_DIR" elasticsearch
end script
@dguaraglia

This comment has been minimized.

Copy link

commented Jul 29, 2011

Hah, this saved me a bunch of work :)

@rbscott

This comment has been minimized.

Copy link
Owner Author

commented Jul 31, 2011

The original version had a few typos in it, the new version fixes

  • Issues with the config path not working.
  • No longer need a pid file (it is running in the foreground)
  • Removed variables that do not seem to have an impact
@ghost

This comment has been minimized.

Copy link

commented Sep 21, 2012

Why did you get rid of the PID file?

@rbscott

This comment has been minimized.

Copy link
Owner Author

commented Oct 31, 2012

Since the process is running in the foreground, you don't really need a PID file. Upstart takes care of all of the process management for starting and stopping the daemon.

@rdkls

This comment has been minimized.

Copy link

commented Feb 4, 2014

Thanks! Headsup even though $DAEMON is set, it's not used (/usr/bin/elasticsearch hardcoded)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.