running perl script in cron

Discussion in 'Perl Misc' started by Edward, May 13, 2004.

  1. Edward

    Edward Guest

    Can't seem to get this working.


    Crontab entry:
    55 17 * * * /usr/home/edward/perl/perfanalyser/plTest 2>&1

    Script (plTest):
    #!/usr/local/bin/perl

    open TEST, ">>/usr/home/edward/perl/perfanalyser/test.txt";
    print TEST "hello\n";


    Cron job fails:
    Your "cron" job on ldtcce04
    /usr/home/edward/perl/perfanalyser/plTest 2>&1

    produced the following output:

    ld.so.1: /usr/local/bin/perl: fatal: libgdbm.so.2: open failed: No
    such file or directory
    Killed


    Tried:
    55 17 * * * su - edward /usr/home/edward/perl/perfanalyser/plTest 2>&1

    Cron job fails:
    our "cron" job on ldtcce04
    su - edwardo /usr/home/edward/perl/perfanalyser/plTest 2>&1

    produced the following output:

    /usr/home/edward/perl/perfanalyser/plTest: open: command not found
    /usr/home/edward/perl/perfanalyser/plTest: print: command not found

    I added to edward's .profile:
    PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/ccs/bin
    export PATH
    LD_LIBRARY_PATH=/usr/local/lib:enfinity0/oracle_client/lib
    export LD_LIBRARY_PATH


    Any ideas?

    Thanks,

    Edward
    Edward, May 13, 2004
    #1
    1. Advertising

  2. In article <>,
    Edward <> wrote:
    :Can't seem to get this working.



    :55 17 * * * /usr/home/edward/perl/perfanalyser/plTest 2>&1

    :Cron job fails:
    :ld.so.1: /usr/local/bin/perl: fatal: libgdbm.so.2: open failed: No
    :such file or directory

    :I added to edward's .profile:
    :pATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/ccs/bin
    :export PATH
    :LD_LIBRARY_PATH=/usr/local/lib:enfinity0/oracle_client/lib
    :export LD_LIBRARY_PATH

    cron jobs are not interactive jobs, and don't automatically source
    your .profile. Try

    55 17 * * * . /usr/home/edward/.profile; /usr/home/edward/perl/perfanalyser/plTest 2>&1
    --
    Beware of bugs in the above code; I have only proved it correct,
    not tried it. -- Donald Knuth
    Walter Roberson, May 13, 2004
    #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. dpackwood
    Replies:
    3
    Views:
    1,784
  2. Zakir Zakir

    running ab command in cron

    Zakir Zakir, Jul 28, 2008, in forum: Ruby
    Replies:
    2
    Views:
    96
    Zakir Zakir
    Jul 29, 2008
  3. Eric Peterson

    shutdown of linux box from cron perl script

    Eric Peterson, Jan 6, 2005, in forum: Perl Misc
    Replies:
    6
    Views:
    414
    Steven_Smith
    Jan 10, 2005
  4. Micha
    Replies:
    2
    Views:
    314
    Henry Law
    Mar 23, 2008
  5. Replies:
    4
    Views:
    292
    ccc31807
    Jul 29, 2011
Loading...

Share This Page