0

Java クラスを実行するための次のスクリプトを作成しました。

#!/bin/sh

# Set this to the directory where the JDK is installed
JAVA_HOME=/opt/weblogic-9.2mp1/java1.5

# Set this to the path to the JAR file containing the JMS classes
# (for example, the path to the weblogic.jar file)
JMS_JAR=/opt/weblogic-9.2mp1/weblogic92/server/lib/weblogic.jar

# Specify the name of the <ServerNode> node in ASC
SERVER_NODE_NAME=TDCPublisher

# If you have custom save beans and load beans in your own JAR file,
# append your JAR file to this variable.
CLASSPATH=$JMS_JAR:$JAR_DIR/ClfyCore.jar:$JAR_DIR/awsi.jar:$JAR_DIR/acfglib.jar:$JAR_DIR/jaxen-1.1-beta-9.jar:$JAR_DIR/Amdocs
Aif.jar:$JAR_DIR/AmdocsProcMgrBase.jar:$JAR_DIR/AmdocsSvcCommon.jar:/apps/fasigw/test/fasigwApp/custom/FASIGWLink.jar
export CLASSPATH

# Set the path for accessing the JDK directory
PATH=$JAVA_HOME/bin:$PATH
export PATH

checkJDK()
{
  if [ ! -f $JAVA_HOME/bin/java ]; then
    echo "Error: $JAVA_HOME/bin/java not found."
    echo "Please edit this script so that the JAVA_HOME variable"
    echo "points to the root directory of your JDK installation."
    return 1
  fi
  return 0
}

checkClassPath()
{
  if [ ! -f $JAR_DIR/ClfyCore.jar ]; then
    echo "Error: $JAR_DIR/ClfyCore.jar not found."
    echo "Please edit this script so that the JAR_DIR variable"
    echo "points to the directory where ClfyCore.jar and the other"
    echo "ClarifyCRM JAR files are located."
  return 1
  fi
  return 0
}

main()
{
  checkJDK
      if [ $? != 0 ]; then
        return 1
      fi
  checkClassPath
      if [ $? != 0 ]; then
        return 1
      fi


$JAVA_HOME/bin/java -Djava.security.auth.login.config=/apps/fasigw/test/AmdocsCRM7.5/AmdocsCRMApplication/conf/auth.conf  -
cp ${CLASSPATH} com.clarify.daevtpub.ClarifyEventProcessor sa cleartest -pl ${SERVER_NODE_NAME} -ShowStatus -Debug -OutFile /
apps/fasigw/test/logs/DataChangeLog.log

  return 0
}

main $*

しかし、直面している問題は、サーバーを終了して再度ログインすると、コマンドps -efを使用してプロセスが実行されていることを確認できますが、クラスが実行されていないことです。スクリプトの実行を手動で再開する必要があります。これを回避し、スクリプトがバックグラウンドで継続的に実行されるようにするにはどうすればよいですか? スクリプト名は startEventProcessor で、次のコマンドを実行してスクリプトを実行します。

./startEventProcessor &
4

1 に答える 1

2

nohupを使用してください:

nohup ./startEventProcessor &
于 2012-12-27T05:29:05.660 に答える