[Chicago-talk] Is it running from cron?

brian d foy brian.d.foy at gmail.com
Wed Feb 21 16:25:25 PST 2007

On 2/21/07, Jim Jacobus <JJacobus at ponyx.com> 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.

I like to set a variable in my cron tab. I can then check for that in
my script if I decide that I want to act differently:

1 2 3 4 5 /some/command some args

brian d foy <brian.d.foy at gmail.com>

More information about the Chicago-talk mailing list