process coredumps when started from cron - Unix

This is a discussion on process coredumps when started from cron - Unix ; Hi all, I have searched all over the place but still I couldn't figure this out. So I am putting my question here to see if someone can help me. I have a JAVA program that I start using a ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: process coredumps when started from cron

  1. process coredumps when started from cron

    Hi all, I have searched all over the place but still I couldn't figure
    this out. So I am putting my question here to see if someone can help
    me. I have a JAVA program that I start using a shell script called
    runNotesMonitored.sh. The script takes three parameters: start, stop,
    restart. This script works perfectly fine when executed from the
    command line and the JAVA program starts and runs happily. How ever,
    when I try to automate this process by putting the script in a cron to
    start the job everyday at midnight, the process coredumps. Please see
    if you can help point me in the right direction.

    Here is the shell script:

    #!/bin/sh

    # Startup/Shutdown script for the notes processor
    #
    # pidfile: logs/notes.pid
    #
    #

    BOOT_CLASSPATH=-Xbootclasspath/p:monitor/connectors/APConn.jar:monitor/Agent.jar
    INTROSCOPE_OPTIONS=-Dcom.wily.introscope.agentProfile=monitor/IntroscopeAgent.profile

    echo=/bin/echo
    pid_file=logs/notes.pid

    return_value=0

    # Starts the Notes processor

    start() {
    if [ -r $pid_file ]
    then
    $echo "The notes processor is already running."
    else
    $echo "Starting the notes processor."
    nohup $JAVA_HOME/bin/java ${BOOT_CLASSPATH}
    ${INTROSCOPE_OPTIONS} -jar "lib/billing_notes-33.0.jar" $@ >
    logs/run.log 2>&1 &
    notes_pid=$!
    $echo $notes_pid > $pid_file
    fi
    }

    # Stops the Notes processor

    stop() {
    if [ -r $pid_file ]
    then
    $echo "Stopping the notes processor."
    kill `cat $pid_file`
    rm -f $pid_file
    else
    $echo "Notes processor is already stopped."
    fi
    }

    # Command line options.
    case "$1" in
    start)
    start
    ;;

    stop)
    stop
    ;;

    restart)
    stop
    start
    ;;
    *)
    $echo "Usage: $0 {start|stop|restart}"
    return_value=1
    ;;
    esac

    exit $return_value


    And, here is what my cron looks like:

    00 00 * * * $HOME/scripts/runNotesMonitored.sh restart >>
    /tmp/runNotes_cron.log


    Any help is appreciated.


  2. Re: process coredumps when started from cron

    stevenkapoor wrote:
    > Hi all, I have searched all over the place but still I couldn't figure
    > this out. So I am putting my question here to see if someone can help
    > me. I have a JAVA program that I start using a shell script called
    > runNotesMonitored.sh. The script takes three parameters: start, stop,
    > restart. This script works perfectly fine when executed from the
    > command line and the JAVA program starts and runs happily. How ever,
    > when I try to automate this process by putting the script in a cron to
    > start the job everyday at midnight, the process coredumps. Please see
    > if you can help point me in the right direction.
    >

    ....
    >
    > Any help is appreciated.
    >


    cron uses mimimal environment.
    To test how the script runs with minimal environment, do

    env -i PATH=/bin:/usr/bin runNotesMonitored.sh


    --
    Michael Tosch @ hp : com

  3. Re: process coredumps when started from cron

    stevenkapoor wrote:

    >Hi all, I have searched all over the place but still I couldn't figure
    >this out. So I am putting my question here to see if someone can help
    >me. I have a JAVA program that I start using a shell script called
    >runNotesMonitored.sh. The script takes three parameters: start, stop,
    >restart. This script works perfectly fine when executed from the
    >command line and the JAVA program starts and runs happily. How ever,
    >when I try to automate this process by putting the script in a cron to
    >start the job everyday at midnight, the process coredumps. Please see
    >if you can help point me in the right direction.
    >
    >Here is the shell script:
    >
    >#!/bin/sh
    >
    ># Startup/Shutdown script for the notes processor
    >#
    ># pidfile: logs/notes.pid
    >#
    >#
    >
    >BOOT_CLASSPATH=-Xbootclasspath/p:monitor/connectors/APConn.jar:monitor/Agent.jar
    >INTROSCOPE_OPTIONS=-Dcom.wily.introscope.agentProfile=monitor/IntroscopeAgent.profile
    >
    >echo=/bin/echo
    >pid_file=logs/notes.pid
    >
    >return_value=0
    >
    ># Starts the Notes processor
    >
    >start() {
    > if [ -r $pid_file ]
    > then
    > $echo "The notes processor is already running."
    > else
    > $echo "Starting the notes processor."
    > nohup $JAVA_HOME/bin/java ${BOOT_CLASSPATH}
    >${INTROSCOPE_OPTIONS} -jar "lib/billing_notes-33.0.jar" $@ >
    >logs/run.log 2>&1 &
    > notes_pid=$!
    > $echo $notes_pid > $pid_file
    > fi
    >}
    >
    ># Stops the Notes processor
    >
    >stop() {
    > if [ -r $pid_file ]
    > then
    > $echo "Stopping the notes processor."
    > kill `cat $pid_file`
    > rm -f $pid_file
    > else
    > $echo "Notes processor is already stopped."
    > fi
    >}
    >
    ># Command line options.
    >case "$1" in
    >start)
    > start
    > ;;
    >
    >stop)
    > stop
    > ;;
    >
    >restart)
    > stop
    > start
    > ;;
    >*)
    > $echo "Usage: $0 {start|stop|restart}"
    > return_value=1
    > ;;
    >esac
    >
    >exit $return_value
    >
    >
    >And, here is what my cron looks like:
    >
    >00 00 * * * $HOME/scripts/runNotesMonitored.sh restart >>
    >/tmp/runNotes_cron.log
    >
    >
    >Any help is appreciated.
    >
    >
    >

    Check the LD_LIBRARY_PATH.
    This has the path of all run time library.

    Regards,
    Thobias Vakayil

+ Reply to Thread