1 Reply Latest reply: Mar 19, 2013 7:03 AM by Catch 22 RSS

    /etc/init.d/nodemgr: line 96: syntax error near unexpected token `is'

    564841
      I am trying to modify the unix script to auto start nodemanager on Oracle Linux server,however i am getting below error when ever i tried to start service nodemgr restart


      here is script:
      ============
      #!/bin/sh
      #
      # nodemgr Oracle Weblogic NodeManager service
      #
      # chkconfig: 345 85 15
      # description: Oracle Weblogic NodeManager service
      # The script needs to be saved as /etc/init.d/nodemgr and then issue chkconfig .add nodemgr as root

      ### BEGIN INIT INFO
      # Provides: nodemgr
      # Required-Start: $network $local_fs
      # Required-Stop:
      # Should-Start:
      # Should-Stop:
      # Default-Start: 3 4 5
      # Default-Stop: 0 1 2 6
      # Short-Description: Oracle Weblogic NodeManager service.
      # Description: Starts and stops Oracle Weblogic NodeManager.
      ### END INIT INFO

      . /etc/rc.d/init.d/functions

      export WLS_HOME=/u01/Oracle/Middleware/wlserver_10.3
      export MW_HOME=/u01/Oracle/Middleware
      export JAVA_HOME=/u01/Oracle/Middleware/jdk160_24
      export IDM_HOME=/u01/Oracle/Middleware/Oracle_IDM1
      export OAM_HOME=/u01/Oracle/Middleware/Oracle_IDM2
      export ORACLE_INSTANCE=/u01/Oracle/Middleware/Oracle_IDM1
      export IAM_HOME=/u01/Oracle/Middleware/Oracle_IDM2
      export DOMAIN_HOME=/u01/Oracle/Middleware/user_projects/domains

      DAEMON_USER="oracle"
      PROCESS_STRING="^.*/u01/Oracle/Middleware/.*weblogic.NodeManager.*"

      source $MW_HOME/wlserver_10.3/server/bin/setWLSEnv.sh > /dev/null
      export NodeManagerHome="$WLS_HOME/common/nodemanager"
      NodeManagerLockFile="$NodeManagerHome/nodemanager.log.lck"

      PROGRAM="$MW_HOME/wlserver_10.3/server/bin/startNodeManager.sh"
      SERVICE_NAME=`/bin/basename $0`
      LOCKFILE="/var/lock/subsys/$SERVICE_NAME"

      RETVAL=0

      start() {
      OLDPID=`/usr/bin/pgrep -f $PROCESS_STRING`
      if [ ! -z "$OLDPID" ]; then
      echo "$SERVICE_NAME is already running (pid $OLDPID) !"
      exit
      fi

      echo -n $"Starting $SERVICE_NAME: "
      /bin/su $DAEMON_USER -c "$PROGRAM &"

      RETVAL=$?
      echo
      [ $RETVAL -eq 0 ] && touch $LOCKFILE
      }

      stop() {
      echo -n $"Stopping $SERVICE_NAME: "
      OLDPID=`/usr/bin/pgrep -f $PROCESS_STRING`
      if [ "$OLDPID" != "" ]; then
      /bin/kill -TERM $OLDPID
      else
      /bin/echo "$SERVICE_NAME is stopped"
      fi
      echo
      /bin/rm -f $NodeManagerLockFile
      [ $RETVAL -eq 0 ] && rm -f $LOCKFILE

      }

      restart() {
      stop
      sleep 10
      start
      }

      case "$1. in
      start)
      start
      ;;
      stop)
      stop
      ;;
      restart|force-reload|reload)
      restart
      ;;
      condrestart|try-restart)
      [ -f $LOCKFILE ] && restart
      ;;
      status)
      OLDPID=`/usr/bin/pgrep -f $PROCESS_STRING`
      if [ "$OLDPID" != "" ]; then
      /bin/echo "$SERVICE_NAME is running (pid: $OLDPID)!"
      else
      /bin/echo "$SERVICE_NAME is stopped"
      fi
      RETVAL=$?
      ;;
      *)
      echo $"Usage: $0 start"
      exit 1
      esac
      exit $RETVAL

      =================
      here is error message
      -----------------------------
      [root@oam init.d]# service nodemgr restart
      /etc/init.d/nodemgr: line 96: syntax error near unexpected token `is'
      /etc/init.d/nodemgr: line 96: `/bin/echo "$SERVICE_NAME is running ("pid: $OLDPID")"'