[Chicago-talk] Is it running from cron?

Andy Lester andy at petdance.com
Wed Feb 21 15:43:51 PST 2007


On Feb 21, 2007, at 5:41 PM, Jim Jacobus wrote:

> Is there an easy way to test if a script is running from cron? I want
> one script to output differently if it is running with a browser and
> another output when running via cron. I tried using -t to test STDIN
> and STDOUT, but that only tells me if it's running interactively or  
> not.

What does "from cron" mean?  You can tell if it's running in a web  
server process vs. running from the command line, 'cause the web  
server process will likely have an environment variable like MOD_PERL  
or CGI set.

--
Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance






More information about the Chicago-talk mailing list