title: how to ensure that a UNIX script runs continuously?
body: <p>I have written the following script for running a Java class:</p>
  
  <pre><code>#!/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 &lt;ServerNode&gt; 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 $*
  </code></pre>
  
  <p>But the problem faced is - once I exit from the server and login again, though I can see the process is running using the command <strong>ps -ef</strong>,the class is not being executed. I need to manually start running the scrip again. How to avoid this and ensure that the script is continuously running in background? The script name is startEventProcessor and I execute the following command to run the script:</p>
  
  <pre><code>./startEventProcessor &amp;
  </code></pre>