Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Perl script problem under cron

13 views
Skip to first unread message

Rodrick Brown

unread,
May 19, 2003, 12:46:54 AM5/19/03
to
I wrote this perl script when I run it from via command line it runs fine.
but when I schedule it from cron i'ts returning and error in the script I
make 2 system() calls calling /usr/bin/mailx

Your "cron" job on sparky
* /usr/bin/perl /export/home/rbrown/ftp_code/interface.pl

produced the following output:

sh: 4Missy: cannot execute

4Missy seems to be a file in my home directory that someone the perl script
is picking up not sure why, but anyone know why this is happening i'm using
the absolute path in the script /usr/bin/mailx I know perl has modules for
smtp but anyone know why this might be happening ?


Paul Tazzyman

unread,
May 19, 2003, 1:17:03 AM5/19/03
to
To ask the obvious question - is "4Missy" executable - I think cron runs
as root but "chmod +x" on it. The other obvious one ( qalthough answered
?? ) are all paths absolute and viable - cron's home directory is not
the same as yours ??

Rodrick Brown

unread,
May 19, 2003, 1:25:33 AM5/19/03
to
4missy isnt even part of the code, all paths are absolute in the code. Like
I stated before ./foo.pl works just fine but when schedule via cron this is
when the problems evolves.

"Paul Tazzyman" <ptaz...@yahoo.com> wrote in message
news:3ec868cf$0$18028$afc3...@news.optusnet.com.au...

Paul Tazzyman

unread,
May 19, 2003, 1:45:28 AM5/19/03
to
Rodrick Brown wrote:
> 4missy isnt even part of the code, all paths are absolute in the code. Like
> I stated before ./foo.pl works just fine but when schedule via cron this is
> when the problems evolves.

Sorry - didn't mean to ask the too obvious !!

Try renaming "4missy" - something in the execution path must be trying
to execute it. What does "interface.pl" call - if you have some sort of
profiler ( not sure if there is one that works with perl - but try
http://www.perl.com/pub/a/2002/07/16/mod_perl.html ). This should at
least let you trace the execution. Reading more it seems perl has some
sort of profiling built in - see

http://search.cpan.org/author/ILYAZ/DProf-19990108/DProf.pm

Good luck !!

Anthony Mandic

unread,
May 19, 2003, 3:04:00 AM5/19/03
to
Rodrick Brown wrote:
>
> I wrote this perl script when I run it from via command line it runs fine.
> but when I schedule it from cron i'ts returning and error in the script I
> make 2 system() calls calling /usr/bin/mailx
>
> Your "cron" job on sparky
> * /usr/bin/perl /export/home/rbrown/ftp_code/interface.pl
>
> produced the following output:
>
> sh: 4Missy: cannot execute
>
> 4Missy seems to be a file in my home directory that someone the perl script
> is picking up not sure why,

Is it the first file listed when you do "echo *" or "ls" in
your home directory?

> but anyone know why this is happening i'm using
> the absolute path in the script /usr/bin/mailx I know perl has modules for
> smtp but anyone know why this might be happening ?

Cron runs with a minimal environment set. Perhaps the perl script
uses something in yours that's not in cron's. A process of elimination
should reveal what that is.

-am © 2003

scorpion de rooftrouser

unread,
May 19, 2003, 5:18:31 AM5/19/03
to
please can you post the entire scripts somewhere. it will be much easier to
see what is wrong

* Paul Tazzyman <ptaz...@yahoo.com> [2003-05-19 05:45]:

Ronald Kuehn

unread,
May 19, 2003, 5:26:08 AM5/19/03
to
> > "Paul Tazzyman" <ptaz...@yahoo.com> wrote in message
> > news:3ec868cf$0$18028$afc3...@news.optusnet.com.au...
> >
> >>Rodrick Brown wrote:
> >>
> >>>I wrote this perl script when I run it from via command line it runs
> >
> > fine.
> >
> >>>but when I schedule it from cron i'ts returning and error in the script
> >
> > I
> >
> >>>make 2 system() calls calling /usr/bin/mailx
> >>>
> >>>Your "cron" job on sparky
> >>>* /usr/bin/perl /export/home/rbrown/ftp_code/interface.pl
> >>>
> >>>produced the following output:
> >>>
> >>>sh: 4Missy: cannot execute

The corresponding line in your crontab seems garbled.
It looks like cron treats
"* /usr/bin/perl /export/home/rbrown/ftp_code/interface.pl"
as the command to execute. Your crontab line probably has too many
fields like this

0 * * * * * /something

so cron treats the last * as part of the command to execute.

Ronald
--
* Experience is what you get when you were expecting something else.

0 new messages