Skip to content

Instantly share code, notes, and snippets.

@bekatom
Created March 19, 2016 07:09
Show Gist options
  • Select an option

  • Save bekatom/4215f47411d5e55940d6 to your computer and use it in GitHub Desktop.

Select an option

Save bekatom/4215f47411d5e55940d6 to your computer and use it in GitHub Desktop.
/etc/init.d/consul
#
# Daemon for Consul
#
# chkconfig: 345 99 20
# description: Daemon for vault
# processname: vault
### BEGIN INIT INFO
# Provides: consul
# Required-Start: $network
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop consul
# Description: Daemon for vault
### END INIT INFO
#/usr/local/bin/consul agent -config-dir /etc/consul.d/server --advertise=192.168.33.11 2>&1 >> /var/log/consul.log&
start() {
echo "--- Starting Consul ---"
consul agent -config-dir /etc/consul.d/server --advertise=192.168.33.11 >> /var/log/consul.log 2>&1 &
return $?
}
stop() {
# Get the process number and kill the process
echo "--- Stop Consul ---"
kill $(ps -C consul|awk 'END {print $1}')
return $?
}
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
status)
status
RETVAL=$?
;;
seal)
seal
RETVAL=$?
;;
*)
echo $"Usage: vault {start|stop|status|seal}"
RETVAL=2
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment