perl script not running through cron tab - BSD

This is a discussion on perl script not running through cron tab - BSD ; hi iam unable to run even the simplest of perl scripts through crontab. this is the perl script #!/usr/local/bin/perl print"hi there\n"; exit; this is the cron tab i have given 05 04 23 1 * perl /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s- branch/perl1/perl]/filecomp.pl>> /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-branch/perl1/perl/ file4.txt ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: perl script not running through cron tab

  1. perl script not running through cron tab

    hi
    iam unable to run even the simplest of perl scripts through crontab.
    this is the perl script
    #!/usr/local/bin/perl
    print"hi there\n";
    exit;

    this is the cron tab i have given
    05 04 23 1 * perl /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-
    branch/perl1/perl]/filecomp.pl>>
    /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-branch/perl1/perl/
    file4.txt



    now when i open the file4 its blank.

    help plz.

  2. Re: perl script not running through cron tab

    On Jan 23, 3:53*pm, "Helmut Schneider" wrote:
    > <83r...@gmail.com <<83r...@gmail.com> wrote:
    > > iam unable to run even the simplest of perl scripts through crontab.
    > > this is the perl script
    > > #!/usr/local/bin/perl
    > > print"hi there\n";
    > > exit;

    >
    > > this is the cron tab i have given
    > > 05 04 23 1 * perl /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-
    > > branch/perl1/perl]/filecomp.pl>>
    > > /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-branch/perl1/perl/
    > > file4.txt

    >
    > cron has no idea what or where 'perl' is. So use /usr/local/bin/perl
    > instead.
    >
    > Helmut
    >
    > --
    > No Swen today, my love has gone away
    > My mailbox stands for lorn, a symbol of the dawn


    tried and failed.

  3. Re: perl script not running through cron tab


    > > this is the cron tab i have given
    > > 05 04 23 1 * perl /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-
    > > branch/perl1/perl]/filecomp.pl>>
    > > /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-branch/perl1/perl/
    > > file4.txt

    >
    > cron has no idea what or where 'perl' is. So use /usr/local/bin/perl
    > instead.


    Is perl actually in /usr/local/bin/perl?
    What happens if you type the cron line on the command line, exactly as shown
    above?

    Are there two '>' signs to redirect? That doesn't work, at least.

    Jan



  4. Re: perl script not running through cron tab

    On Wed, 23 Jan 2008 11:31:25 UTC, 83rish@gmail.com wrote:

    > On Jan 23, 3:53*pm, "Helmut Schneider" wrote:
    > > <83r...@gmail.com <<83r...@gmail.com> wrote:
    > > > iam unable to run even the simplest of perl scripts through crontab.
    > > > this is the perl script
    > > > #!/usr/local/bin/perl
    > > > print"hi there\n";
    > > > exit;

    > >
    > > > this is the cron tab i have given
    > > > 05 04 23 1 * perl /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-
    > > > branch/perl1/perl]/filecomp.pl>>
    > > > /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-branch/perl1/perl/
    > > > file4.txt

    > >
    > > cron has no idea what or where 'perl' is. So use /usr/local/bin/perl
    > > instead.


    > tried and failed.


    Several things here.

    Do you actually have perl installed, and is it in /usr/local/bin ? :

    ls -l /usr/local/bin/perl

    Cron jobs run in a restricted environment, and that doesn't include
    /usr/local/bin (see crontab(5)). You need to add:

    PATH=/bin:/usr/bin/:/usr/local/bin

    (or similar) to the top of the crontab.

    Lastly, if the perl script is marked executable, you can leave out the
    'perl' at the start of each crontab command.
    --
    Bob Eager
    UNIX since v6..
    http://tinyurl.com/2xqr6h


  5. Re: perl script not running through cron tab

    On Jan 23, 4:41*pm, "Bob Eager" wrote:
    > On Wed, 23 Jan 2008 11:31:25 UTC, 83r...@gmail.com wrote:
    > > On Jan 23, 3:53*pm, "Helmut Schneider" wrote:
    > > > <83r...@gmail.com <<83r...@gmail.com> wrote:
    > > > > iam unable to run even the simplest of perl scripts through crontab.
    > > > > this is the perl script
    > > > > #!/usr/local/bin/perl
    > > > > print"hi there\n";
    > > > > exit;

    >
    > > > > this is the cron tab i have given
    > > > > 05 04 23 1 * perl /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-
    > > > > branch/perl1/perl]/filecomp.pl>>
    > > > > /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-branch/perl1/perl/
    > > > > file4.txt

    >
    > > > cron has no idea what or where 'perl' is. So use /usr/local/bin/perl
    > > > instead.

    > > tried and failed.

    >
    > Several things here.
    >
    > Do you actually have perl installed, and is it in /usr/local/bin ? *:
    >
    > * * * *ls -l /usr/local/bin/perl
    >
    > Cron jobs run in a restricted environment, and that doesn't include
    > /usr/local/bin (see crontab(5)). You need to add:
    >
    > * PATH=/bin:/usr/bin/:/usr/local/bin
    >
    > (or similar) to the top of the crontab.
    >
    > Lastly, if the perl script is marked executable, you can leave out the
    > 'perl' at the start of each crontab command.
    > --
    > Bob Eager
    > UNIX since v6..http://tinyurl.com/2xqr6h- Hide quoted text -
    >
    > - Show quoted text -



    1.yes i have run the /usr/local/bin/perl command .it is there
    2.the perl script is executable
    3.56 06 23 1 * /usr/local/bin/perl /tpf106/data2/cis_web/cis3/cis3.11/
    work/rishi/s-branch/perl1/perl/first1.pl>>file4.txt
    not working.


  6. Re: perl script not running through cron tab

    On Wed, 23 Jan 2008 11:57:13 UTC, 83rish@gmail.com wrote:

    > On Jan 23, 4:41*pm, "Bob Eager" wrote:
    > > On Wed, 23 Jan 2008 11:31:25 UTC, 83r...@gmail.com wrote:
    > > > On Jan 23, 3:53*pm, "Helmut Schneider" wrote:
    > > > > <83r...@gmail.com <<83r...@gmail.com> wrote:
    > > > > > iam unable to run even the simplest of perl scripts through crontab.
    > > > > > this is the perl script
    > > > > > #!/usr/local/bin/perl
    > > > > > print"hi there\n";
    > > > > > exit;

    > >
    > > > > > this is the cron tab i have given
    > > > > > 05 04 23 1 * perl /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-
    > > > > > branch/perl1/perl]/filecomp.pl>>
    > > > > > /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-branch/perl1/perl/
    > > > > > file4.txt

    > >
    > > > > cron has no idea what or where 'perl' is. So use /usr/local/bin/perl
    > > > > instead.
    > > > tried and failed.

    > >
    > > Several things here.
    > >
    > > Do you actually have perl installed, and is it in /usr/local/bin ? *:
    > >
    > > * * * *ls -l /usr/local/bin/perl
    > >
    > > Cron jobs run in a restricted environment, and that doesn't include
    > > /usr/local/bin (see crontab(5)). You need to add:
    > >
    > > * PATH=/bin:/usr/bin/:/usr/local/bin
    > >
    > > (or similar) to the top of the crontab.
    > >
    > > Lastly, if the perl script is marked executable, you can leave out the
    > > 'perl' at the start of each crontab command.
    > > --
    > > Bob Eager
    > > UNIX since v6..http://tinyurl.com/2xqr6h- Hide quoted text -
    > >
    > > - Show quoted text -

    >
    >
    > 1.yes i have run the /usr/local/bin/perl command .it is there
    > 2.the perl script is executable
    > 3.56 06 23 1 * /usr/local/bin/perl /tpf106/data2/cis_web/cis3/cis3.11/
    > work/rishi/s-branch/perl1/perl/first1.pl>>file4.txt
    > not working.


    You missed a bit. Have you added that PATH statement to the top of the
    crontab?


    --
    Bob Eager
    UNIX since v6..
    http://tinyurl.com/2xqr6h


  7. Re: perl script not running through cron tab

    On Wed, 23 Jan 2008 01:09:48 -0800 (PST) in <969d416d-2015-4b9a-bc5c-a0bf73e4ed8f@s19g2000prg.googlegroups.com> 83rish@gmail.com <83rish@gmail.com> wrote:
    > hi
    > iam unable to run even the simplest of perl scripts through crontab.
    > this is the perl script
    > #!/usr/local/bin/perl
    > print"hi there\n";
    > exit;
    >
    > this is the cron tab i have given
    > 05 04 23 1 * perl /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-
    > branch/perl1/perl]/filecomp.pl>>
    > /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-branch/perl1/perl/
    > file4.txt


    Okay, that you chose such horridly long paths instead of /tmp
    for testing indicates that you are probably a mortal luser instead
    of someone actually responsible for the box and that you should
    have contacted your sysadmin, manager, or sales rep instead of
    posting to this newsgroup. IE it isn't a FreeBSD problem, it's a
    local configuration/policy problem.

    In the off chance that it isn't...

    cat > /tmp/crontest.sh << EEOOTT
    #!/bin/sh
    exec > /tmp/crontest.sh.out
    set
    EEOOTT
    chmod 555 /tmp/crontest.sh

    Add a contrab entries
    * * * * * /bin/echo crontest2
    * * * * * /tmp/crontest.sh || /bin/echo could not exec

    Wait a few minutes.
    Do you have an email with the body
    "crontest2"?
    Does /tmp/crontest.sh.out exist?
    Do you have an email with the body
    "could not exec"?
    Is the horrid path you gave on a local disk, or is it coming in
    from some networked filesystem?

    If you cannot create the script, there is something screwy
    with your environment, contact your sysadmin or manager instead
    of this newsgroup.

    If you do not have an email with the body "crontest2" you are
    most likely in an environment where you are not an admin and
    cron has been disabled either for you explicitly or for almost every
    user.
    If you have a "crontest2" email, and a "could not exec" email,
    you have something odd in your environment. Contact your sysadmin.
    If you have the crontest2 email, and no "could not exec" email,
    you should have a /tmp/crontest.sh.out. If not your admin is doing
    something screwy with a chroot environment.

    If the horrid path you gave is not a local filesystem there are a couple
    VFS quirks to contend with. 1) If the mount point for any of the
    non-local filesystems traversed does not include o+x permission,
    getpwd() may return '' and 'cd ..' may dump the problem into /.
    2) Just because you had access to reach the perl script doesn't mean
    that user 'root' does. Default implementation of 'cron' shouldn't care,
    but are you 100% certain it's running a default implementation of
    'cron'?
    >
    >
    >
    > now when i open the file4 its blank.


    Oh and last but not least...
    Use a '>' instead of '>>'.
    That way you can go by the test 'does the file exist?'
    >
    > help plz.


    Learn to spell your words completely.


    --
    Chris Dukes
    "Let all the babies be born. Then let us drown those we do not like."
    -- G. K. Chesterton.

  8. Re: perl script not running through cron tab

    On Jan 23, 4:00*am, "Bob Eager" wrote:
    > On Wed, 23 Jan 2008 11:57:13 UTC, 83r...@gmail.com wrote:
    > > On Jan 23, 4:41*pm, "Bob Eager" wrote:
    > > > On Wed, 23 Jan 2008 11:31:25 UTC, 83r...@gmail.com wrote:
    > > > > On Jan 23, 3:53*pm, "Helmut Schneider" wrote:
    > > > > > <83r...@gmail.com <<83r...@gmail.com> wrote:
    > > > > > > iam unable to run even the simplest of perl scripts through crontab.
    > > > > > > this is the perl script
    > > > > > > #!/usr/local/bin/perl
    > > > > > > print"hi there\n";
    > > > > > > exit;

    >
    > > > > > > this is the cron tab i have given
    > > > > > > 05 04 23 1 * perl /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-
    > > > > > > branch/perl1/perl]/filecomp.pl>>
    > > > > > > /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-branch/perl1/perl/
    > > > > > > file4.txt

    >
    > > > > > cron has no idea what or where 'perl' is. So use /usr/local/bin/perl
    > > > > > instead.
    > > > > tried and failed.

    >
    > > > Several things here.

    >
    > > > Do you actually have perl installed, and is it in /usr/local/bin ? *:

    >
    > > > * * * *ls -l /usr/local/bin/perl

    >
    > > > Cron jobs run in a restricted environment, and that doesn't include
    > > > /usr/local/bin (see crontab(5)). You need to add:

    >
    > > > * PATH=/bin:/usr/bin/:/usr/local/bin

    >
    > > > (or similar) to the top of the crontab.

    >
    > > > Lastly, if the perl script is marked executable, you can leave out the
    > > > 'perl' at the start of each crontab command.
    > > > --
    > > > Bob Eager
    > > > UNIX since v6..http://tinyurl.com/2xqr6h-Hide quoted text -

    >
    > > > - Show quoted text -

    >
    > > 1.yes i have run the /usr/local/bin/perl command .it is there
    > > 2.the perl script is executable
    > > 3.56 06 23 1 * /usr/local/bin/perl /tpf106/data2/cis_web/cis3/cis3.11/
    > > work/rishi/s-branch/perl1/perl/first1.pl>>file4.txt
    > > not working.

    >
    > You missed a bit. Have you added that PATH statement to the top of the
    > crontab?
    >
    > --
    > Bob Eager
    > UNIX since v6..http://tinyurl.com/2xqr6h- Hide quoted text -
    >
    > - Show quoted text -


    great!!! its working now
    thanks bob.

+ Reply to Thread