85 lines
2.0 KiB
Plaintext
85 lines
2.0 KiB
Plaintext
#!/bin/bash
|
|
#-----------------------------------------------------------------------------
|
|
# Copyright (c) 2012 Bryce Johnson
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#-----------------------------------------------------------------------------
|
|
### BEGIN INIT INFO
|
|
# Provides: jira
|
|
# Required-Start:
|
|
# Required-Stop:
|
|
# Should-Start:
|
|
# Should-Stop:
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: Start up jira Git Server
|
|
# Description: Atlassian jira Enterprise Git Server
|
|
# This service starts up the tomcat webapp.
|
|
### END INIT INFO
|
|
ACTION=$1
|
|
SERVICE=jira
|
|
lockfile=/var/lock/subsys/$SERVICE
|
|
|
|
export JAVA_HOME=<%= scope.lookupvar('jira::params::javahome') %>
|
|
|
|
|
|
function restart() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
function stop() {
|
|
echo -n $"Shutting down $SERVICE: "
|
|
<%= scope.lookupvar('jira::params::webappdir') %>/bin/stop-jira.sh
|
|
RETVAL=$?
|
|
echo
|
|
|
|
#If all is well remove the lockfile
|
|
[ $RETVAL -eq 0 ] && rm -f $lockfile
|
|
return $RETVAL
|
|
}
|
|
|
|
function start() {
|
|
echo -n $"Starting $SERVICE: "
|
|
<%= scope.lookupvar('jira::params::webappdir') %>/bin/start-jira.sh
|
|
RETVAL=$?
|
|
echo
|
|
|
|
#If all is well touch the lock file
|
|
[ $RETVAL -eq 0 ] && touch $lockfile
|
|
return $RETVAL
|
|
}
|
|
|
|
|
|
|
|
function execute() {
|
|
case "$ACTION" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
status)
|
|
status $SERVICE
|
|
;;
|
|
restart)
|
|
restart
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|status|restart}"
|
|
exit 1
|
|
esac
|
|
}
|
|
|
|
execute |