Find the answer to your Linux question:
Results 1 to 3 of 3
Hi Experts, I need some urgent help here. I have 2 application specific commands which generates certain output. My intension was to run these commands every 15 mins between 1PM ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2012
    Posts
    4

    Question crontab doesnt run my command properly


    Hi Experts,
    I need some urgent help here.
    I have 2 application specific commands which generates certain output. My intension was to run these commands every 15 mins between 1PM to 3PM. For that I have written the following in
    crontab -e
    Code:
    00,15,30,45 13-15 * * * /opt/SM/RUN/sm_perf_load.sh >> /opt/SM/RUN/perf_log.log
    inside the sm_perf_load.sh, I have written the following
    Code:
    /opt/SM/RUN/sm -reportshm
    /opt/SM/RUN/sm -reportlbstatus
    The problem now, when the cron runs the above script, only the output of first command inside the .sh files gets stored in to the log file. Second command doesnt store anything at all.
    I even tried to use 2>&1 to see if it generates any error, but no luck.

  2. #2
    Just Joined!
    Join Date
    Jan 2011
    Location
    Cambridge, Ontario, Canada
    Posts
    24

    More Details, Please

    What happens if you run:

    /opt/SM/RUN/sm -reportlbstatus

    in an interactive shell? Different output? Please explain how it's different if it is.

    Also, tell us whether interactively running:

    /opt/SM/RUN/sm_perf_load.sh >> /opt/SM/RUN/perf_log.log

    every 15 mins would give you desired results or not.

    Remember that cron doesn't know about the same environment variables that shells do (such as $USER) (common source of errors).

    Lastly, try substituting:

    echo "foo" >> /opt/SM/RUN/perf_log.log

    into your crontab just to be sure that your cron statement works. There are different versions of cron out there.

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Location
    Silver Spring, MD
    Posts
    95

    Do you know the version of crontab and OS?

    The person earlier stated that there are different versions of crontab.

    So this will help in the analysis.

    Todd

  4. $spacer_open
    $spacer_close

Posting Permissions

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