[ale] Bash: How to determine if called from cron?

Geoffrey esoteric at 3times25.net
Mon Jun 27 10:51:55 EDT 2005


Christopher Bergeron wrote:
> Does anyone know of an easy way for my script to determine if it's being
> run from cron or from a user shell?
> I have a feeling theres an easy way to do this, but I'm drawing a
> complete blank right now.  I'm looking at my Environment vars, but I'm
> not sure what gets set by Cron when it runs a script.
> 
> Any ideas are much appreciated...

The value of $TERM should be set to something like 'dumb' or unset as
you're not running from a terminal.  Assuming the user shell is running
from a standard login shell, TERM will have a valid value. (vt100, linux..)

-- 
Until later, Geoffrey



More information about the Ale mailing list