Crowd自启动脚本

crowd自启动脚本下载地址:

http://down.51cto.com/data/156592

由于crowd用rc.local是无法自启动的,所以这里附上crowd的启动脚本

将以下脚本拷贝到/etc/init.d/crowd

# cd /etc/init.d/

# vi crowd

脚本在附件中可以下载得到,其中主要注意

$Crowd的修改,其他地方基本不需要改了。

-------------------------------------------------------------------------------------

 

#!/bin/bash

### BEGIN INIT INFO

# chkconfig:    2345 85 15

# Provides:          atlassian

# Short-Description: Start and stop the crowd server

# Description:       Start and stop the crowd server.

### END INIT INFO

#

. /etc/init.d/functions

Crowd=/www/atlassian/crowd/2.1.0/

startup=$Crowd/apache-tomcat/bin/startup.sh

shutdown=$Crowd/apache-tomcat/bin/shutdown.sh

export JAVA_HOME=/usr/local/java/jdk1.6.0_22

start(){

 echo -n $"Starting Crowd"

 #daemon -c

 $startup

 RETVAL=$?

 echo

}

stop(){

 echo $"Stopping Crowd"

 $shutdown

 RETVAL=$?

 echo

}

restart(){

  stop

  sleep 10

  start

}

status(){

        numproc=`ps -ef | grep crowd | grep -v "grep crowd" | wc -l`

        if [ $numproc -gt 0 ]; then

                echo "Crowd is running..."

        else

                echo "Crowd 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

 

-------------------------------------------------------------------------------------

# chkconfig --add crowd

# chkconfig crowd on

# service crowd start

没有报错即成功

 

 

这里有点需要注意,由于java的启动和关闭都需要一些时间,所以在stop或者start后最好能看着日志。

#tail -f  $install_crowd/apache-tomcat/logs/catalina.out

待最后提示启动或者关闭了再运行关闭或者启动的service程序,否则会报错。

脚本还在初级阶段,如果有什么好的意见或者建议可以提出来。

 

用ps查看下进程,有条目即表示运行正常

# ps aux | grep crowd | grep -v "grep crowd"

本文出自 “滕赖赖的技术小窝” 博客,转载请与作者联系!

你可能感兴趣的:(职场,脚本,自启动,休闲,Crowd)