The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cpanel, Cron and Java Classpaths

Discussion in 'General Discussion' started by fiftythree, Feb 18, 2007.

  1. fiftythree

    fiftythree Registered

    Joined:
    Jan 26, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hey, I'm new to Cpanel and having a hell of a time with getting my Java to run on the Cron scheduler.

    The only options from the interface are to insert a job, and send an email to somebody.
    So if I need to add PATH or CLASSPATH information so that things will run correctly, how do you do that !!!!????

    I have set it up and can run it through SSH with that user after modifying that users .bashrc file, but that is only good if you're running stuff through the SSH.
     
  2. appservermgr

    appservermgr Member

    Joined:
    Feb 16, 2007
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    You should create a script file for your cron job.
    In the script file you would include the command of course and in addition set the
    CLASSPATH, JAVA_HOME and any other variables like so:

    EXPORT CLASSPATH=$CLASSPATH:./lib/lib1jar:./lib/lib2.jar
    EXPORT JAVA_HOME=/usr/java/jdk_version
     
  3. fiftythree

    fiftythree Registered

    Joined:
    Jan 26, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Interestingly enough, I've been trying that, but without success.
    Originally I had the following:

    Code:
    #!/bin/bash
    
    export JL=~/java/lib
    export CLASSPATH=$CLASSPATH:~/java:$JL/pg73jdbc3.jar:$JL/edtftpj-1.4.5.jar:$JL/mail.jar:$JL/ftp.jar
    export PATH=/home/mlsupdat/java:/home/mlsupdat/java/bin:$PATH
    
    java myjafafile > logfile
    
    
    all the "exports" are included in the users .bashrc file and allow the java to run correctly.

    and then I added (after your email)

    Code:
    export JAVA_HOME=/usr/local/jdk/bin/
    but I'm still coming up with the error:

    libgcj-java-placeholder.sh

    This script is a placeholder for the /usr/bin/java​
     
  4. fiftythree

    fiftythree Registered

    Joined:
    Jan 26, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Well, I figured it out.


    I needed the following (which is included in the standard .bashrc file)

    Code:
    if [ -f /etc/bashrc ]; then
            . /etc/bashrc
    fi

    I now see, finally, that THIS is the global bashrc file.
    Can you tell me what that part of the script actually does?
    I'm guessing, if it isn't loaded, it loads it...


    Thanks for the quick reply.


    Herb
     
    #4 fiftythree, Feb 18, 2007
    Last edited: Feb 18, 2007
  5. appservermgr

    appservermgr Member

    Joined:
    Feb 16, 2007
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    /etc/bashrc
    has default global settings.
    The values would be set by the system admin.
     
Loading...

Share This Page