exec ok in Perl but not as a cron

Discussion in 'Perl Misc' started by John, Mar 25, 2010.

  1. John

    John Guest

    Hi

    exec '/home/john/www/www.example.com/cgi-bin/main.pl automatic';
    works OK in Perl program

    The following in a crontab:
    10 * * * * /home/john/www/www.example.com/cgi-bin/main.pl automatic

    produces:-
    Can't locate Library.pm in @INC

    main.pl begins:-

    use lib '../';
    use strict;
    use warnings;
    use Library; my $library=new Library;

    Any ideas?

    John
    John, Mar 25, 2010
    #1
    1. Advertising

  2. John

    John Guest

    "Ben Morrow" <> wrote in message
    news:...
    >
    > Quoth "John" <>:
    >>
    >> exec '/home/john/www/www.example.com/cgi-bin/main.pl automatic';
    >> works OK in Perl program
    >>
    >> The following in a crontab:
    >> 10 * * * * /home/john/www/www.example.com/cgi-bin/main.pl automatic
    >>
    >> produces:-
    >> Can't locate Library.pm in @INC
    >>
    >> main.pl begins:-
    >>
    >> use lib '../';

    >
    > Here's your problem. cron isn't running the script from the directory
    > you expect. Put an absolute path there instead.
    >
    > Ben
    >


    Hi

    Many thanks. Done that and it is working from cron.
    Regards
    John
    John, Mar 25, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hal Vaughan
    Replies:
    11
    Views:
    1,087
    Gordon Beaton
    May 22, 2006
  2. tedsuzman
    Replies:
    2
    Views:
    7,058
    Michel Claveau, résurectionné d'outre-bombe inform
    Jul 21, 2004
  3. Bryan
    Replies:
    3
    Views:
    1,012
    J Kenneth King
    Jul 27, 2009
  4. Otto __
    Replies:
    1
    Views:
    103
    Robert Klemme
    Oct 13, 2008
  5. Bucker

    Runs Fine In Perl :: Not As Cron Job

    Bucker, Jan 15, 2007, in forum: Perl Misc
    Replies:
    6
    Views:
    173
    -berlin.de
    Jan 17, 2007
Loading...

Share This Page