Last active
October 18, 2017 18:00
-
-
Save peterneorr/055c3bcff56f8d64b5111a1e605110e1 to your computer and use it in GitHub Desktop.
Apollo 1.7.1 /etc/init.d script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Important
APOLLOSCRIPT
to point to the correct script.APOLLO_USER
that should be changed to the service user "apollo"