我确实在Ubuntu 10.4服务器上安装了WSO2 Identity服务器并将其连接到MySQL数据库。现在我创建了一个用户wso2user,并为该用户提供了对WSO2文件夹的完全权限。当我使用以下命令启动服务器时:
#! /bin/sh
su wso2user -c '/opt/identitywso2/bin/wso2server.sh'
服务器启动,我可以登录,但是我的命令提示符保留在shell中,并带有最后一条日志消息:
[2014-05-19 14:14:27,938] INFO {org.wso2.carbon.identity.entitlement.internal.EntitlementServiceComponent} - Started thrift entitlement service at port:10500
[2014-05-19 14:14:43,534] INFO {org.wso2.carbon.identity.entitlement.internal.SchemaBuilder} - XACML policy schema loaded successfully.
可能有什么不对?我想开始发球而不需要留在外壳中。
感谢任何提示。 卢卡斯
答案 0 :(得分:1)
这是我的脚本,基于WSO2 API Manager,但您也可以用于任何其他WSO2产品。脚本基于Suse EE SP3。将此文件放在/etc/init.d中并执行checkconfig。
#!/bin/sh
#
# /etc/init.d/wso2
# init script for wso2.
#
# chkconfig: 2345 90 60
# description: wso2 indexer service
#
RETVAL=0
. /etc/rc.status
BAD_USER="This script should be run as root or as wso2 user. Exiting......."
cmd="/bin/sh -c"
if [ "$USER" != 'root' -a "$USER" != 'wso2' -a "$USER" != '' ]; then echo $BAD_USER && exit 1;fi
if [ "$USER" == 'root' -o "$USER" == '' ]; then cmd="su - wso2 -c";fi
wso2pid=`pidof java`
wso2_start() {
echo Starting wso2...
$cmd "/opt/wso2/am/bin/wso2server.sh --start"
}
wso2_stop() {
echo Stopping wso2...
$cmd "/opt/wso2/am/bin/wso2server.sh --stop"
if [ -n "$wso2pid" ]
then
echo -n "Waiting for wso2 ($wso2pid)"
while [[ ( -d /proc/$wso2pid ) ]]
do
echo -n "."
sleep 1
done
echo "Stopped"
fi
}
wso2_restart() {
echo Restarting wso2...
$cmd "/opt/wso2/am/bin/wso2server.sh --restart"
}
wso2_status() {
echo -n "Status of wso2 is "
if [ -n "$wso2pid" ]
then echo "Running. ($wso2pid)"
else echo "Stopped."
fi
}
case "$1" in
status)
wso2_status
;;
start)
wso2_start
;;
stop)
wso2_stop
;;
restart)
wso2_restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL