vault server shell for amazon linux (start only)
#!/bin/bash
# chkconfig: 345 98 20
# description: Vault Server
# processname: vaultserver
###
# usage
#
# $ sudo chkconfig --add vaultserver
# $ sudo chkconfig on vaultserver
#
###
. /etc/init.d/functions
path="/usr/local/bin/vault"
name=$(basename $path)
appdir="${APP_DIR}"
config="/etc/vault/config.hcl"
pidfile="/var/run/${name}.pid"
lockfile="/var/lock/subsys/${name}"
RETVAL=0
start() {
echo -n $"Starting $name: "
daemon --pidfile ${pidfile} ${path} server -config ${config} &
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $name: "
killproc -p ${pidfile} ${name} -INT
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} ${path}
RETVAL=$?
;;
restart)
stop
start
;;
*)
echo $"Usage: $name {start|stop|restart|status}"
RETVAL=2
esac
exit $RETVAL