need help - user permissions / cron - Linux

This is a discussion on need help - user permissions / cron - Linux ; Hello, Newbie needs help resolving user permissions and automation RH Linux 8.0. Apache Perl 5.8.1 mysql Ver 12.22 bogofilter 0.15.7 ClamAV 0.65 Problem: When I run a perl script from cron, the calls to bogofilter and clamav don't work. When ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: need help - user permissions / cron

  1. need help - user permissions / cron

    Hello,

    Newbie needs help resolving user permissions and automation

    RH Linux 8.0.
    Apache
    Perl 5.8.1
    mysql Ver 12.22
    bogofilter 0.15.7
    ClamAV 0.65

    Problem: When I run a perl script from cron, the calls to bogofilter and
    clamav don't work.

    When I run perl script from web (cgi), they work very well, also, they work
    from the command line when I execute the script manually.

    Thanks



  2. Re: need help - user permissions / cron

    More info:

    The perl script pop-forwards an email, writes it to a temporary file (on a
    RAM disk), then passes the file on the command line to bogofilter and clamav
    using `backtick operators`. Works fine via command line or cgi web, but not
    with cron.

    ??




    "Chris Fortune" wrote in message
    news:LXghc.61211$dg7.59814@edtnps84...
    > Hello,
    >
    > Newbie needs help resolving user permissions and automation
    >
    > RH Linux 8.0.
    > Apache
    > Perl 5.8.1
    > mysql Ver 12.22
    > bogofilter 0.15.7
    > ClamAV 0.65
    >
    > Problem: When I run a perl script from cron, the calls to bogofilter and
    > clamav don't work.
    >
    > When I run perl script from web (cgi), they work very well, also, they

    work
    > from the command line when I execute the script manually.
    >
    > Thanks
    >
    >




  3. Re: need help - user permissions / cron

    On Wed, 21 Apr 2004 02:36:34 GMT, Chris Fortune wrote:
    > More info:
    >
    > The perl script pop-forwards an email, writes it to a temporary file (on a
    > RAM disk), then passes the file on the command line to bogofilter and clamav
    > using `backtick operators`. Works fine via command line or cgi web, but not
    > with cron.


    add a path statement to all executables.
    Put a status check after each command and echo fault to a file to see
    where it fails.

    Please read http://www.catb.org/~esr/faqs/smart-questions.html
    Show us the code.

  4. Re: need help - user permissions / cron

    Chris Fortune said the following, on 04/20/04 22:36:
    > More info:
    >
    > The perl script pop-forwards an email, writes it to a temporary file (on a
    > RAM disk), then passes the file on the command line to bogofilter and clamav
    > using `backtick operators`. Works fine via command line or cgi web, but not
    > with cron.
    >
    > ??
    >
    >


    Suggestions:

    1. Specify commands (e.g., 'bogofilter') with the full path name.

    2. Check the man pages for cron and crontab for your system, to make
    sure you understand the "initial conditions" (such as $PATH and other
    environment variables) when cron starts your script. I suspect you will
    find that you need to explicitly set something that is normally set in
    an initialization file.


    --
    Rich Gibbs
    rgibbs@his.com

  5. Re: need help - user permissions / cron - solution

    Thanks for heading me in the right direction!

    I did a simple experiment
    # crontab -e
    */1 * * * * echo $PATH > cronpath.test.txt

    one minute later here was the contents of cronpath.test.txt:
    /sbin:/usr/sbin
    # rather limited, eh?

    the path to bogofilter and clamav is /usr/local/bin, hmmmmm.

    # echo $PATH
    #
    /usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/
    bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin

    so added this line to crontab, explicitly
    PATH=/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:
    /usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin

    http://howtos.linuxbroker.com/Path.html#ss10.1




    "Rich Gibbs" wrote in message
    news:4085f323@news101.his.com...
    > Chris Fortune said the following, on 04/20/04 22:36:
    > > More info:
    > >
    > > The perl script pop-forwards an email, writes it to a temporary file (on

    a
    > > RAM disk), then passes the file on the command line to bogofilter and

    clamav
    > > using `backtick operators`. Works fine via command line or cgi web, but

    not
    > > with cron.
    > >
    > > ??
    > >
    > >

    >
    > Suggestions:
    >
    > 1. Specify commands (e.g., 'bogofilter') with the full path name.
    >
    > 2. Check the man pages for cron and crontab for your system, to make
    > sure you understand the "initial conditions" (such as $PATH and other
    > environment variables) when cron starts your script. I suspect you will
    > find that you need to explicitly set something that is normally set in
    > an initialization file.
    >
    >
    > --
    > Rich Gibbs
    > rgibbs@his.com




  6. Re: need help - user permissions / cron - solution

    Chris Fortune said the following, on 04/21/04 06:26:
    > Thanks for heading me in the right direction!
    >
    > I did a simple experiment
    > # crontab -e
    > */1 * * * * echo $PATH > cronpath.test.txt
    >
    > one minute later here was the contents of cronpath.test.txt:
    > /sbin:/usr/sbin
    > # rather limited, eh?
    >

    [SNIP]

    Glad to help. On most Unix/Linux systems, 'cron' gives you a pretty
    limited initial environment. I think the reasoning (which I agree with)
    is that the default facilities for things that run "untouched by human
    hands" should be limited, and that it is easy enough to specify any
    special requirements.


    --
    Rich Gibbs
    rgibbs@his.com

+ Reply to Thread