[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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