#!/bin/sh
# JIRA service
#
# chkconfig: - 95 05
# Author: San
# Date: 2015-12-01
LANG="zh_CN.UTF-8"
export LANG
. /etc/rc.d/init.d/functions
Prog_Dir=/data1/Jira/atlassian-jira-6.3.6-standalone/bin
prog=jira
pidfile=${PIDFILE-/var/run/jira.pid}
lockfile=${LOCKFILE-/var/lock/subsys/jira}
args="--daemon --pid-file=${pidfile} $OPTIONS"
lockfile=/var/lock/subsys/$prog
cd $Prog_Dir
start() {
[ -x $Prog_Dir/start-jira.sh ] || exit 5
echo -n $"Starting $prog: "
daemon --pidfile=${pidfile} $Prog_Dir/start-jira.sh $args
retval=$?
echo
if [ $retval -eq 0 ]; then
touch $lockfile || retval=4
fi
pid=$(ps aux |grep jira |grep -v grep |awk '{print $2}')
echo $pid >/var/run/jira.pid
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
rh_status() {
# run checks to determine if the service is running or use generic status
status -p ${pidfile} $prog
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
status)
rh_status
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 2
esac
exit $?