Skip to content

Instantly share code, notes, and snippets.

@peterneorr
Last active October 18, 2017 18:00
Show Gist options
  • Save peterneorr/055c3bcff56f8d64b5111a1e605110e1 to your computer and use it in GitHub Desktop.
Save peterneorr/055c3bcff56f8d64b5111a1e605110e1 to your computer and use it in GitHub Desktop.
Apollo 1.7.1 /etc/init.d script
#!/bin/bash
#
# apollo start/stop Apollo MQ
#
# chkconfig: 2345 90 10
#
# Description: ApolloMQ init script
# Source function library.
. /etc/init.d/functions
APOLLOSCRIPT=/var/lib/YOUR-BROKER-NAME-HERE/bin/apollo-broker-service
RETVAL=0
prog="apollo"
LOCKFILE=/var/lock/subsys/$prog
SERVICEUSER=apollo
start() {
echo -n "Starting $prog: "
su $SERVICEUSER -c "$APOLLOSCRIPT start"
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
echo
return $RETVAL
}
stop() {
echo -n "Shutting down $prog: "
$APOLLOSCRIPT stop
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
echo
return $RETVAL
}
status(){
echo -n "Checking $prog status: "
$APOLLOSCRIPT status
RETVAL=$?
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
*)
echo "Usage: apollo {start|stop|status|restart}"
exit 1
;;
esac
exit $?
@peterneorr
Copy link
Author

peterneorr commented Oct 18, 2017

Important

  • change APOLLOSCRIPT to point to the correct script.
  • The default generated apollo-broker-service contains a var called APOLLO_USER that should be changed to the service user "apollo"

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