shell脚本进行设置启动/关闭
vi /etc/init.d/confluence
-----------------------------
#!/bin/bash
# chkconfig: 2345 85 15
# Provides: atlassian
# Short-Description: Start and stop the Jira&Confluence server
# Description: Start and stop the Jira&Confluence server.
# source function library
./etc/init.d/functions
Confluence=/home/atlassian/confluence
startup=$Confluence/bin/startup.sh
shutdown=$Confluence/bin/shutdown.sh
export JAVA_HOME=/home/java/jdk1.8.0_181
start(){
echo -n $"Starting Confluence"
#daemon -c
$startup
RETVAL=$?
echo
}
stop(){
echo $"Stopping Confluence"
$shutdown
RETVAL=$?
echo
}
restart(){
stop
start
}
status(){
numproc=`ps -ef | grep confluence | grep -v "grep confluence" | wc -l`
if [ $numproc -gt 0 ]; then
echo "Confluence is running..."
else
echo "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
---------------------------
需要对 文件赋可执行权限
chmod +x /etc/init.d/confluence
cd /etc/init.d
添加服务
chkconfig --add confluence
查看confluence服务启动级别
chkconfig --list
保证2-5开启
chkconfig -s confluence on
测试启动confluence
service confluence start
重启centos
reboot
confluence 自动启动