Skip to content

Instantly share code, notes, and snippets.

@hashbrowncipher
Created October 23, 2016 19:26
Show Gist options
  • Save hashbrowncipher/1f4fa6f39c4f05f69833c691689f9d41 to your computer and use it in GitHub Desktop.
Save hashbrowncipher/1f4fa6f39c4f05f69833c691689f9d41 to your computer and use it in GitHub Desktop.
Upstart script for Cassandra
description "Cassandra"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [06]
limit nofile 1000000 1000000
limit memlock unlimited unlimited
setuid cassandra
respawn
respawn limit 2 120
chdir /var/lib/cassandra
pre-start script
[ -e /run/cassandra ] || \
install -d -ocassandra -gcassandra -m755 /run/cassandra
end script
script
pidfile=/run/cassandra/cassandra.pid
cassandra_home=`getent passwd cassandra | awk -F ':' '{ print $6; }'`
heap_dump_f="$cassandra_home/java_`date +%s`.hprof"
error_log_f="$cassandra_home/hs_err_`date +%s`.log"
echo $$ > "$pidfile"
exec /usr/sbin/cassandra -p "$pidfile" -H "$heap_dump_f" -E "$error_log_f" -f
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment