Incomplete output from crontab email: running shell scripts from a perl script 
Author Message
 Incomplete output from crontab email: running shell scripts from a perl script

I am running a perl script from my crontab.  The perl script that I
run executes shell scripts at the command line.  My crontab sends me
the output from this perl script that runs shell scripts.  However, if
I run the shell scripts directly from the crontab itself I get a
different output (the output that I want).

Why would a perl script that runs a shell script give me a different
"cron job" output then the shell script itself?

I don't think it is a perl problem but I am running the shell scripts
from perl with the following command: `$shell_script`.

Any help would be greatly appreciated.



Mon, 12 Jan 2004 04:51:48 GMT  
 Incomplete output from crontab email: running shell scripts from a perl script

Quote:

> I am running a perl script from my crontab.  The perl script that I
> run executes shell scripts at the command line.  My crontab sends me
> the output from this perl script that runs shell scripts.  However, if
> I run the shell scripts directly from the crontab itself I get a
> different output (the output that I want).
> Why would a perl script that runs a shell script give me a different
> "cron job" output then the shell script itself?

jobs executed by cron can have a different environment than the same
job executed in an interactive shell:

  + different $PATH
  + different current working directory
  + different shell (cron executes its jobs with sh.  is sh your shell?)

---
"... What with you being his parents and all, I think that you could
be trusted not to shaft him."  -- Robert Chang, rec.games.board




Mon, 12 Jan 2004 04:56:27 GMT  
 Incomplete output from crontab email: running shell scripts from a perl script

Quote:
> I am running a perl script from my crontab.  The perl script that I
> run executes shell scripts at the command line.  My crontab sends me
> the output from this perl script that runs shell scripts.  However, if
> I run the shell scripts directly from the crontab itself I get a
> different output (the output that I want).

> Why would a perl script that runs a shell script give me a different
> "cron job" output then the shell script itself?

> I don't think it is a perl problem but I am running the shell scripts
> from perl with the following command: `$shell_script`.

That assigns the STDOUT of the script to $_ unless you assign it to a
variable and/or print that at some point.  Does it work like you expect if
you do:  print `shell_script`; [or maybe you want to use system()]?

--
David Efflandt  (Reply-To is valid)  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/



Mon, 12 Jan 2004 11:20:33 GMT  
 Incomplete output from crontab email: running shell scripts from a perl script

Quote:


> > I am running a perl script from my crontab.  The perl script that I
> > run executes shell scripts at the command line.  My crontab sends me
> > the output from this perl script that runs shell scripts.  However,
> > if I run the shell scripts directly from the crontab itself I get a
> > different output (the output that I want).

> > Why would a perl script that runs a shell script give me a different
> > "cron job" output then the shell script itself?

> jobs executed by cron can have a different environment than the same
> job executed in an interactive shell:

>   + different $PATH
>   + different current working directory
>   + different shell (cron executes its jobs with sh.  is sh your
>     shell?)

Also:

  + no controlling terminal [tty or pty or whatever].
  + current uid, gid, and euid may be different (not sure on this).

The lack of a terminal is unlikely to cause problems, but you may have
permissions problems.  This would be similar to when a program is called
via CGI.

--
I need more taglines. This one is getting old.



Thu, 15 Jan 2004 04:00:47 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Running Perl script w/i Unix Shell Script

2. Help: Running Perl script from Shell script, passing variables

3. Problems running perl scripts from crontab on SunOS 4.3.1

4. lossage running perl script from crontab

5. Can a Crontab run perl script

6. Crontab:Automatically Run a Perl Script?

7. SUMMARY: Re: how to get PERLLIB set correctly when running a script from crontab

8. how to get PERLLIB set correctly when running a script from crontab

9. a script's own fullpath, when run in crontab

10. shell script from within a shell script

11. Formatted Email output from Perl Scripts Possible?

12. How to run shell commands from Perl script?

 

 
Powered by phpBB® Forum Software