假设jboss7的安装路径为/opt//jboss-as-7.1.0.Final
启动standload,新建一个start_jboss.sh文件,内容如下:
#!/bin/bash
jboss_home=/opt/jboss-as-7.1.0.Final
jboss_process=`ps aux | grep org.jboss.as.standalone | grep -v grep | awk '{print $2}'`
if [ ! -z $jboss_process ];then
echo Jboss process $jboss_process is running.
exit
echo testexit
fi
if [ ! -d $jboss_home ];then
echo The directory $jboss_home is not existed.
fi
cd $jboss_home/bin || echo "Can't access $jboss_home/bin directory."
nohup ./standalone.sh &
关闭standload,新建一个stop_jboss.sh文件,内容如下:
jboss_home=/opt/jboss-as-7.1.0.Final
jboss_process=`ps aux | grep org.jboss.as.standalone | grep -v grep | awk '{print $2}'`
if [ ! -z $jboss_process ];then
echo Jboss process $jboss_process is running.
exit
echo testexit
fi
if [ ! -d $jboss_home ];then
echo The directory $jboss_home is not existed.
fi
cd $jboss_home/bin || echo "Can't access $jboss_home/bin directory."
nohup ./standalone.sh &
关闭standload,新建一个stop_jboss.sh文件,内容如下:
#!/bin/bash
#echo ${jboss_process}
#jboss_process=ps aux | grep jboss | awk '{print $2}' | sed -n '1p'
jboss_process=`ps aux | grep org.jboss.as.standalone | grep -v grep | awk '{print $2}'`
if [ -z ${jboss_process} ];then
echo Jboss service is not running.
else
kill -9 ${jboss_process}
sleep 1
echo Jboss process ${jboss_process} is killed.
fi
#echo ${jboss_process}
#jboss_process=ps aux | grep jboss | awk '{print $2}' | sed -n '1p'
jboss_process=`ps aux | grep org.jboss.as.standalone | grep -v grep | awk '{print $2}'`
if [ -z ${jboss_process} ];then
echo Jboss service is not running.
else
kill -9 ${jboss_process}
sleep 1
echo Jboss process ${jboss_process} is killed.
fi
运行时赋予这两个脚本可执行权限即可。