Skip to content

Instantly share code, notes, and snippets.

@peterneorr
Created October 24, 2017 00:03
Show Gist options
  • Save peterneorr/0eb4e34218f83948851ea6b1df9aed11 to your computer and use it in GitHub Desktop.
Save peterneorr/0eb4e34218f83948851ea6b1df9aed11 to your computer and use it in GitHub Desktop.
ActiveMQ /etc/init.d/ script
#!/bin/bash
#
# start/stop Active MQ
#
# chkconfig: 2345 90 10
#
# Description: ActiveMQ init script
# Source function library.
. /etc/init.d/functions
SCRIPT=/opt/activemq/bin/activemq
RETVAL=0
prog="activemq"
LOCKFILE=/var/lock/subsys/$prog
SERVICEUSER=activemq
start() {
echo -n "Starting $prog: "
su $SERVICEUSER -c "$SCRIPT start"
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
echo
return $RETVAL
}
stop() {
echo -n "Shutting down $prog: "
$SCRIPT stop
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
echo
return $RETVAL
}
status(){
echo -n "Checking $prog status: "
$SCRIPT status
RETVAL=$?
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
*)
echo "Usage: $prog {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