Doubt with a cron job - SCO

This is a discussion on Doubt with a cron job - SCO ; Hi Folks, I am trying to schedule a cron job in which a shell script is fired, this shell script in turn is calling another shell script (so the first one is essentially a wrapper). The second shell script expects ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Doubt with a cron job

  1. Doubt with a cron job

    Hi Folks,
    I am trying to schedule a cron job in which a shell script
    is fired, this shell script in turn is calling another shell script
    (so the first one is essentially a wrapper). The second shell script
    expects command line arguments so in the wrapper script i have HERE
    document operator to give the input..this runs fine when i run it
    using the prompt but when i cron it nothing happens at all!!! I am a
    bit confused!!!!
    Is it the case that you can not run a script expecting command line
    arguments through cron....


  2. Re: Doubt with a cron job

    In article <1182418027.669587.213210@i38g2000prf.googlegroups. com>,
    wrote:
    > I am trying to schedule a cron job in which a shell script
    >is fired, this shell script in turn is calling another shell script
    >(so the first one is essentially a wrapper). The second shell script
    >expects command line arguments so in the wrapper script i have HERE
    >document operator to give the input..this runs fine when i run it
    >using the prompt but when i cron it nothing happens at all!!! I am a
    >bit confused!!!!
    >Is it the case that you can not run a script expecting command line
    >arguments through cron....


    It's not clear what you're doing, since a HERE document provides an input
    stream, not command line arguments, but in any case you can certainly run a
    script expecting command line arguments via cron, so that isn't your problem.
    Do you know whether the script is being run at all? Check the read time on the
    wrapper script (with ls -lT) before and after it should have been run; when run
    it will be updated to the current time. You can also turn on cron logging; see
    the cron(C) man page.

    If none of that helps, and your wrapper is small, you may want to post it
    (along with the crontab line used to invoke it). Also, you may want to check
    out

    ftp://ftp.armory.com/pub/admin/cronjob

    which can help debug cron problems by letting you selectively simulate parts
    of the cron environment - see the execution environment control options at the
    end of the help (-h) output.

    John
    --
    John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/

  3. Re: Doubt with a cron job

    On Jun 21, 8:11 am, spce...@armory.com (John DuBois) wrote:
    > In article <1182418027.669587.213...@i38g2000prf.googlegroups. com>,
    >
    > wrote:
    > > I am trying to schedule a cron job in which a shell script
    > >is fired, this shell script in turn is calling another shell script
    > >(so the first one is essentially a wrapper). The second shell script
    > >expects command line arguments so in the wrapper script i have HERE
    > >document operator to give the input..this runs fine when i run it
    > >using the prompt but when i cron it nothing happens at all!!! I am a
    > >bit confused!!!!
    > >Is it the case that you can not run a script expecting command line
    > >arguments through cron....

    >
    > It's not clear what you're doing, since a HERE document provides an input
    > stream, not command line arguments, but in any case you can certainly run a
    > script expecting command line arguments via cron, so that isn't your problem.
    > Do you know whether the script is being run at all? Check the read time on the
    > wrapper script (with ls -lT) before and after it should have been run; when run
    > it will be updated to the current time. You can also turn on cron logging; see
    > the cron(C) man page.
    >
    > If none of that helps, and your wrapper is small, you may want to post it
    > (along with the crontab line used to invoke it). Also, you may want to check
    > out
    >
    > ftp://ftp.armory.com/pub/admin/cronjob
    >
    > which can help debug cron problems by letting you selectively simulate parts
    > of the cron environment - see the execution environment control options at the
    > end of the help (-h) output.
    >
    > John
    > --
    > John DuBois spce...@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/


    Also identify the SCO version. The cron environment is more
    controllable in later versions.

    Scripts that don't scrupulously set their environments sometimes have
    trouble in cron. E.g., scripts that expect TERM to be set or that
    expect a particular PATH.

    --RLR


  4. Re: Doubt with a cron job

    On Thu, 21 Jun 2007 02:27:07 -0700, kulkasac@gmail.com wrote:

    >Hi Folks,
    > I am trying to schedule a cron job in which a shell script
    >is fired, this shell script in turn is calling another shell script
    >(so the first one is essentially a wrapper). The second shell script
    >expects command line arguments so in the wrapper script i have HERE
    >document operator to give the input..this runs fine when i run it
    >using the prompt but when i cron it nothing happens at all!!! I am a
    >bit confused!!!!
    >Is it the case that you can not run a script expecting command line
    >arguments through cron....


    Cron generally does not have the same PATH that you have on the
    command line. To be sure of properly executing commands in cron use
    the full path name for each command in your scripts.

    --
    Richard Seeder

+ Reply to Thread