[code]#!/bin/bash
#
### BEGIN INIT INFO
# Provides: atlassian
# Required-Start:
# Required-Stop:
# Should-Start: $mysql
# Should-Stop: $mysql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the Jira&Confluence server
# Description: Start and stop the Jira&Confluence server.
### END INIT INFO
#
tomcat=/home/jxb/apps/atlassian-jira-enterprise-3.6.5-standalone
startup=$tomcat/bin/startup.sh
shutdown=$tomcat/bin/shutdown.sh
export JAVA_HOME=/usr/lib/jvm/java-6-sun
start(){
echo -n $"Starting Jira&Confluence service: "
#daemon -c
$startup
RETVAL=$?
echo
}
stop(){
echo $"Stopping Jira&Confluence service: "
$shutdown
RETVAL=$?
echo
}
restart(){
stop
start
}
status(){
numproc=`ps -ef | grep atlassian-jira | grep -v "grep atlassian-jira" | wc -l`
if [ $numproc -gt 0 ]; then
echo "Jira&Confluence is running..."
else
echo "Jira&Confluence is stopped..."
fi
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit 0
[/code]
#
### BEGIN INIT INFO
# Provides: atlassian
# Required-Start:
# Required-Stop:
# Should-Start: $mysql
# Should-Stop: $mysql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the Jira&Confluence server
# Description: Start and stop the Jira&Confluence server.
### END INIT INFO
#
tomcat=/home/jxb/apps/atlassian-jira-enterprise-3.6.5-standalone
startup=$tomcat/bin/startup.sh
shutdown=$tomcat/bin/shutdown.sh
export JAVA_HOME=/usr/lib/jvm/java-6-sun
start(){
echo -n $"Starting Jira&Confluence service: "
#daemon -c
$startup
RETVAL=$?
echo
}
stop(){
echo $"Stopping Jira&Confluence service: "
$shutdown
RETVAL=$?
echo
}
restart(){
stop
start
}
status(){
numproc=`ps -ef | grep atlassian-jira | grep -v "grep atlassian-jira" | wc -l`
if [ $numproc -gt 0 ]; then
echo "Jira&Confluence is running..."
else
echo "Jira&Confluence is stopped..."
fi
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit 0
[/code]
本文介绍了一个用于管理Jira与Confluence服务的Shell脚本,该脚本能够启动、停止、重启及检查服务状态。通过设置环境变量JAVA_HOME来确保使用正确的Java版本,并且针对特定目录下的Tomcat提供了操作指令。
714

被折叠的 条评论
为什么被折叠?



