Skip to content

Instantly share code, notes, and snippets.

@nodtem66
Created October 13, 2014 07:52
Show Gist options
  • Save nodtem66/76499f6b94b898cc7ffb to your computer and use it in GitHub Desktop.
Save nodtem66/76499f6b94b898cc7ffb to your computer and use it in GitHub Desktop.
Dataturbine RBNB startup service (/etc/init.d/rbnb)
#!/bin/sh
### BEGIN INIT INFO
# Provides: rbnb
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the dataturbine rbnb server
# Description: starts rbnb using start-stop-daemon
### END INIT INFO
RBNB_HOME=/opt/dataturbine
# The install path of the Java Virtual Machine (JVM). This can be either a
# JRE or full SDK installation.
JAVA_HOME=/usr/share/jdk
# Ensure that the RBNB server is installed.
[ -f ${RBNB_HOME}/rbnb.jar ] || exit 0
RBNB_ADDRESS=${2:-localhost:3333}
start() {
if [ "$(ps auxwww | grep rbnb | wc -l)" -gt 1]; then
echo "* $0 is running"
return 1
fi
echo -n $"Starting RBNB: "
${JAVA_HOME}/bin/java \
-jar ${RBNB_HOME}/rbnb.jar \
-a ${RBNB_ADDRESS} \
-F -H ${RBNB_HOME}/data/ \
-l ,100,,append -n "CardioArt DT@DO" &
RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then
touch /var/lock/subsys/rbnb
echo "[OK]"
else
echo "[FAIL]"
fi
echo
return ${RETVAL}
}
stop() {
if [ "$(ps auxwww | grep rbnb | wc -l)" -gt 1 ]; then
PID=$(ps auxwww | grep rbnb | awk {print $2;exit})
echo -n "Shutting down $0 : "
kill -9 $PID
RETVAL=$?
fi
if [ ${RETVAL} -eq 0 ]; then
rm -f /var/lock/subsys/rbnb
echo "[OK]"
else
echo "[FAIL]"
fi
echo
return ${RETVAL}
}
check_status() {
if [ "$(ps auxwww | grep rbnb | wc -l)" -gt 1 ]; then
echo "* $0 is running"
else
echo "* $0 is not running"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
check_status
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment