• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Ubuntu: env variables and scripting issues"

Collapse

  • minestrone
    replied


    Cheers for the advice.

    Set up the root env, set up restart in /etc/init.d/tomcat reboted without login and tomcat is running. Robert is your Mothers Brother.

    Next weeks task is getting mySQL running in a clustered environment for the EC2.

    Time for a beer, cheers.

    Leave a comment:


  • minestrone
    replied
    Originally posted by lilelvis2000 View Post
    They are completely different.

    as a test do
    >env

    and then
    >sudo env

    you'll see the difference.

    You'll need to either keep the script as it is...which IMHO isn't really a hack. Although I had thought that the current java was really done by a symbolic link...but anyway, or put the env variable into the .profile of the root user.
    Yes, that shows up the diff. Going to set up the .profile for the root. cheers

    Leave a comment:


  • minestrone
    replied
    Originally posted by NickFitz View Post
    Yes, I thikn that is pretty similar to lilelvis2000's post where you set it up to start at startup and it will not have any issues with users.

    I think I am used to running tomcat off solaris servers that have not been rebooted for 5 years.

    Leave a comment:


  • lilelvis2000
    replied
    They are completely different.

    as a test do
    >env

    and then
    >sudo env

    you'll see the difference.

    You'll need to either keep the script as it is...which IMHO isn't really a hack. Although I had thought that the current java was really done by a symbolic link...but anyway, or put the env variable into the .profile of the root user.

    Leave a comment:


  • swamp
    replied
    Why you running Tomcat as root? If you need port 80 then run Apache in front.

    Leave a comment:


  • NickFitz
    replied
    This any help?

    Leave a comment:


  • minestrone
    replied
    I think you are right. I set the JAVA_HOME as myself but have to sudo the tomcat to get it to run.

    Strangely it will not let me sudo the export though.

    I think if I let the auto startup run it then I can remove the hack I suppose.

    It is my first experience of running a lynux server after years of solaris, thought they would be the same but it is the small changes that confuse me.

    Cheers

    Leave a comment:


  • lilelvis2000
    replied
    The only thing I can think is that tomcat script is switching to another user and thus using that account's environment instead of yours...but I could be very wrong.

    Leave a comment:


  • minestrone
    replied
    Originally posted by lilelvis2000 View Post
    I haven't read this...but maybe this can help ? http://blog.datajelly.com/company/bl...on-ubuntu.html
    That was almost what I was doing although they were going for auto startup and I was just hand cranking it.

    In the end I just hacked in the export at the top of the startup script which is not perfect but gets it working for now. Do not understand why it just drops the env variables as they are set before calling the script.

    Another entry in the hack list.

    Leave a comment:


  • lilelvis2000
    replied
    I haven't read this...but maybe this can help ? http://blog.datajelly.com/company/bl...on-ubuntu.html

    Leave a comment:


  • minestrone
    started a topic Ubuntu: env variables and scripting issues

    Ubuntu: env variables and scripting issues

    Is there anything different about the way ubuntu deals with env variables in sctipts? I am trying to get tomcat installed and running which is something I have done a thousand times on Solaris.

    It relies on JAVA_HOME being set so...

    Code:
    JAVA_HOME=/opt/java/jdk1.6.0_14
    export JAVA_HOME
    
    echo $JAVA_HOME
    /opt/java/jdk1.6.0_14
    So I kick of the startup script and..

    Code:
    Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
    At least one of these environment variable is needed to run this program
    So a quick look at the startup script and..


    Code:
    # Make sure prerequisite environment variables are set
    if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
      # Bugzilla 37284 (reviewed).
      if $darwin; then
        if [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then
          export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"
        fi
      else
        JAVA_PATH=`which java 2>/dev/null`
        if [ "x$JAVA_PATH" != "x" ]; then
          JAVA_PATH=`dirname $JAVA_PATH 2>/dev/null`
          JRE_HOME=`dirname $JAVA_PATH 2>/dev/null`
        fi
        if [ "x$JRE_HOME" = "x" ]; then
          # XXX: Should we try other locations?
          if [ -x /usr/bin/java ]; then
            JRE_HOME=/usr
          fi
        fi
      fi
      if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
        echo "1Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
        echo "At least one of these environment variable is needed to run this program"
        exit 1
      fi
    fi

Working...
X