Crontab Trouble - Linux

This is a discussion on Crontab Trouble - Linux ; Hi All, I did a search for this and found a number of discussions but the stuff suggested did not help. The problem I have (which from my search a few others seem to have had) is that I can ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Crontab Trouble

  1. Crontab Trouble

    Hi All,

    I did a search for this and found a number of discussions but the
    stuff suggested did not help. The problem I have (which from my search
    a few others seem to have had) is that I can run a bash script
    successfully from the command line but not from the crontab.

    The actual script in itself runs fine. However it is a call to a
    subscript within that script that fails. I redirected the output of
    the cron entry to a tmp file and the error shows that a config file
    could not be found. This file is in the users PATH but i guess not in
    the user running crontab.

    I redirected the env in my crontab to a temp file and got the
    following:
    PWD=/home/rsprod
    LOGNAME=rsprod
    SHLVL=1
    SHELL=/bin/sh
    HOME=/home/rsprod
    PATH=/usr/bin:/bin
    _=/usr/bin/env

    How can I add to this path? Can anyone tell me anything that might
    help my cause?

    Thanks for the help

    Marc

  2. Re: Crontab Trouble

    As you have seen when your cron job runs it has a very limited
    environment. You could set up a variable or adjust the path within
    your script. You can also add or change variables at the top of the
    crontab, like VARIABLE=something. Note that the shell that is being
    run is /bin/sh so it will not have the features of bash.
    You should be to put PATH=$PATH:/path/path1... at the top of
    the crontab to fix your problem.
    It might help to study scripts that are part of your
    installation or study some admin books on scripting. You should never
    make too many assumptions about the outside environment. It will
    almost always be missing something you want.

    On 4 Sep 2003 03:06:02 -0700, mbiggs@liquidcap.com (Marc Biggs) wrote:

    >Hi All,
    >
    >I did a search for this and found a number of discussions but the
    >stuff suggested did not help. The problem I have (which from my search
    >a few others seem to have had) is that I can run a bash script
    >successfully from the command line but not from the crontab.
    >
    >The actual script in itself runs fine. However it is a call to a
    >subscript within that script that fails. I redirected the output of
    >the cron entry to a tmp file and the error shows that a config file
    >could not be found. This file is in the users PATH but i guess not in
    >the user running crontab.
    >
    >I redirected the env in my crontab to a temp file and got the
    >following:
    >PWD=/home/rsprod
    >LOGNAME=rsprod
    >SHLVL=1
    >SHELL=/bin/sh
    >HOME=/home/rsprod
    >PATH=/usr/bin:/bin
    >_=/usr/bin/env
    >
    >How can I add to this path? Can anyone tell me anything that might
    >help my cause?
    >
    >Thanks for the help
    >
    >Marc


    ------------
    Remove the underscores from the e-mail address.

  3. Re: Crontab Trouble

    "Joe Fischer" wrote in message
    news:3f5a7fb9.170271908@news-server.insight.rr.com

    > Note that the shell that is being run is /bin/sh so it will not have the
    > features of bash.


    On every Linux distro I've used, /bin/sh is simply a symlink to /bin/bash.


    tony

    --
    use hotmail com for any email replies


    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

+ Reply to Thread