首先,编写启动脚本jira.sh
cd /opt/jira/bin
vim jira.sh
#! /bin/sh
#prefix=/opt/jira
_ROOT=/opt/jira
_NAME=jira
#停止方法
stop(){
echo "Stoping $_NAME "
$_ROOT/bin/stop-jira.sh
}
case "$1" in
start)
echo "Starting $_NAME "
$_ROOT/bin/start-jira.sh
;;
stop)
stop
;;
restart)
stop
start
;;
status)
ps -ef|grep $_ROOT/work/catalina.pid
;;
*)
printf 'Usage: %s {start|stop|restart|status}\n' "$prog"
exit 1
;;
esac
其次,设置权限及软连接
chmod +x jira.sh
ln -s /opt/jira/bin/jira.sh /etc/init.d/jira
最后,设置启动项
chkconfig --add jira
chkconfig --level 345 jira on