#! /bin/sh
#
# See contrib/init.resin for /etc/rc.d/init.d startup script
#
# resin.sh can be called like apachectl
#
# resin.sh -- execs resin in the foreground
# resin.sh start -- starts resin in the background
# resin.sh stop -- stops resin
# resin.sh restart -- restarts resin
#
# resin.sh will return a status code if the wrapper detects an error, but
# some errors, like bind exceptions or Java errors, are not detected.
#
# To install, you'll need to configure JAVA_HOME and RESIN_HOME and
# copy contrib/init.resin to /etc/rc.d/init.d/resin. Then
# use "unix# /sbin/chkconfig resin on"
#JAVA_HOME
JAVA_HOME=/usr/local/java
export JAVA_HOME
#本脚本的绝对路径
EXEC_START="/usr/local/snsconnector/snsconnector.sh"
#执行脚本
RESIN="bin/httpd.sh"
#执行多个resin的多路径
EXEC="/usr/local/snsconnector/snsapi/resin3 /usr/local/snsconnector/testsns/resin3"
array=($EXEC)
length=${#array[@]}
echo $length
for ((i=0; i<$length; i++))
do
echo ${array[$i]}
done
#####################################################
# Find a PID for the pid file
#####################################################
for ((i=0; i<$length; i++))
do
RESIN_HOME=${array[$i]}
SNS_PIDS="$SNS_PIDS $RESIN_HOME/snsconnector.pid "
done
pids=($SNS_PIDS)
size=${#pids[@]}
echo $size
for ((i=0; i<$size; i++))
do
echo ......${pids[$i]}
done
#
SNS_TAG=snstag
if test -n "${JAVA_HOME}"; then
if test -z "${JAVA_EXE}"; then
JAVA_EXE=$JAVA_HOME/bin/java
fi
fi
#
# trace script and simlinks to find the wrapper
#
if test -z "${RESIN_HOME}"; then
script=`/bin/ls -l $0 | awk '{ print $NF; }'`
while test -h "$script"
do
script=`/bin/ls -l $script | awk '{ print $NF; }'`
done
bin=`dirname $script`
RESIN_HOME="$bin/.."
fi
running()
{
[ -f $1 ] || return 1
PID=$(cat $1)
echo ==========$PID==========
ps -p $PID >/dev/null 2>/dev/null || return 1
return 0
}
usage()
{
echo "Usage: $0 {start|stop|status} [ CONFIGS ... ] "
exit 1
}
[ $# -gt 0 ] || usage