Skip to content

Instantly share code, notes, and snippets.

@dkuppitz
Last active October 20, 2015 19:33
Show Gist options
  • Save dkuppitz/20bda51e3465a612cd9b to your computer and use it in GitHub Desktop.
Save dkuppitz/20bda51e3465a612cd9b to your computer and use it in GitHub Desktop.
#!upstart
description "Gremlin Server"
env GREMLIN_USER=ubuntu
env GREMLIN_GROUP=ubuntu
env GREMLIN_PID_FILE=/var/run/gremlin.pid
env GREMLIN_HOME=/usr/local/gremlin-server-3.0.0.M5
env GREMLIN_LOG=/var/log/gremlin/gremlin-server.log
# uncomment the next line if you want Gremlin Server to start automatically after system reboots
#start on filesystem and net-device-up IFACE=eth0
stop on [016]
respawn
pre-start script
LOG_DIR=`dirname $GREMLIN_LOG`
if [ ! -d $LOG_DIR ]; then
mkdir -p $LOG_DIR
chown -R $GREMLIN_USER:$GREMLIN_GROUP $LOG_DIR
fi
end script
script
if [ -f /etc/default/gremlin-server ]; then . /etc/default/gremlin-server; fi
exec start-stop-daemon --start --make-pidfile --pidfile $GREMLIN_PID_FILE --chuid $GREMLIN_USER --chdir $GREMLIN_HOME --exec $GREMLIN_HOME/bin/gremlin-server.sh >> $GREMLIN_LOG 2>&1
end script
post-stop script
rm -f $GREMLIN_PID_FILE
end script
@dkuppitz
Copy link
Author

dkuppitz commented Nov 6, 2014

Store this file in /etc/init, adjust the environment variables (GREMLIN_USER, GREMLIN_GROUP, etc.), then start/stop the Gremlin Server using:

# start Gremlin Server
sudo start gremlin-server

# stop Gremlin Server
sudo stop gremlin-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment