Find the answer to your Linux question:
Results 1 to 2 of 2
I'm not sure what is buggy with this script. see attached status) TOMCAT_PID=$(pgrep -f "/usr/apache-tomcat-6.0.18/bin") echo $TOMCAT_PID if [-z $TOMCAT_PID] then echo Apache Tomcat running with PID $TOMCAT_PID. exit 1 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    8

    help with scripting


    I'm not sure what is buggy with this script. see attached

    status)
    TOMCAT_PID=$(pgrep -f "/usr/apache-tomcat-6.0.18/bin")
    echo $TOMCAT_PID
    if [-z $TOMCAT_PID] then
    echo Apache Tomcat running with PID $TOMCAT_PID.
    exit 1
    else
    echo Apache Tomcat is not running.
    fi
    ;;




    Command line:
    [root@desktop10 init.d]# ./tomcat status
    ./tomcat: line 29: syntax error near unexpected token `else'
    ./tomcat: line 29: ` else'
    [root@desktop10 init.d]#
    Attached Files Attached Files

  2. #2
    Just Joined!
    Join Date
    Feb 2007
    Location
    LA/Berkeley
    Posts
    33
    try putting a line break before then "then" that comes after [-z $TOMCAT_PID]
    as in:

    TOMCAT_PID=$(pgrep -f "/usr/apache-tomcat-6.0.18/bin")
    echo $TOMCAT_PID
    if [-z $TOMCAT_PID]
    then
    echo Apache Tomcat running with PID $TOMCAT_PID.
    exit 1
    else
    echo Apache Tomcat is not running.
    fi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •