[ale] Bash: How to determine if called from cron?
Christopher Fowler
cfowler at outpostsentinel.com
Mon Jun 27 19:22:42 EDT 2005
env RUNNING_FROM_CRON=TRUE /my/command
On Mon, 2005-06-27 at 18:10 -0400, Michael Still wrote:
> How about setting an environment variable like RUNNING_FROM_CRON=true
> in your crontab and checking it in the script? I don't remember the
> specifics of the environment from cron though, but I think if you set
> it in cron or on the cron command line (like 45 * * * 7 root
> RUNNING_FROM_CRON=true; /my/command) then it'll be in the process
> environment.
>
> On 6/27/05, Christopher Bergeron <christopher at bergeron.com> 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...
> >
> > Kind regards,
> > CB
> >
> >
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > http://www.ale.org/mailman/listinfo/ale
> >
>
>
More information about the Ale
mailing list