[ale] Bash: How to determine if called from cron?
Michael Still
stillwaxin at gmail.com
Mon Jun 27 18:21:47 EDT 2005
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
>
--
[stillwaxin at gmail.com ~]$ cat .signature
cat: .signature: No such file or directory
[stillwaxin at gmail.com ~]$
More information about the Ale
mailing list